Monday, October 21, 2019

Has anyone come up with an annotation processor that can mimic the functionary of resources?

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
   }
}

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/2d85578a-ea6d-4790-a3a9-558eff3aa6d6%40googlegroups.com.

No comments:

Post a Comment