Has anyone come up with an annotation processor that can mimic the functionary of resources?
Something like:
@ResourceBundle
public interface ResourcesBundle {
@ResourceBundleFile("my-test-file.txt")
String getResource1();
@ResourceBundleFile("my-test-data.bin")
byte[] getResource2();
}
public void getResources(){
ResourcesBundle bundle = new ResourcesBundleBuilder(); //where this is the class generated by the annotation processor
String r1 = bundle.getResource1();
byte[] r2 = bundle.getResource2();
}
and the generated class might look something like:
public class ResourcesBundleBuilder {
public String getResource1(){
return "contents of text file embedded into Java as Java escaped string";
}
public byte[] getResource2(){
return new byte[]{1,2,3,4,5,6,7,8,9,0xa,0xb,0xc}; //byte sequence read directly from source file
}
}