Class JavaFileObjects


  • public final class JavaFileObjects
    extends java.lang.Object
    Utility methods related to JavaFileObjects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.tools.JavaFileObject fromResource​(Resource resource, java.lang.String className, javax.tools.JavaFileObject.Kind kind, java.nio.charset.Charset charset)
      Wraps a Resource as a JavaFileObject.
      static javax.tools.JavaFileObject fromResourceCreator​(ResourceCreator resourceCreator, java.lang.String resourceName, javax.tools.JavaFileObject.Kind kind, java.nio.charset.Charset charset)  
      static javax.tools.JavaFileObject fromUrl​(java.net.URL url, java.lang.String name, javax.tools.JavaFileObject.Kind kind)  
      static JavaFileObjects.ByteArrayJavaFileObject inMemory​(java.lang.String className, javax.tools.JavaFileObject.Kind kind2, java.nio.charset.Charset charset)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromResource

        public static javax.tools.JavaFileObject fromResource​(Resource resource,
                                                              java.lang.String className,
                                                              javax.tools.JavaFileObject.Kind kind,
                                                              java.nio.charset.Charset charset)
        Wraps a Resource as a JavaFileObject.
      • fromUrl

        public static javax.tools.JavaFileObject fromUrl​(java.net.URL url,
                                                         java.lang.String name,
                                                         javax.tools.JavaFileObject.Kind kind)
        Returns:
        The resource designated by the url, wrapped in a JavaFileObject
      • inMemory

        public static JavaFileObjects.ByteArrayJavaFileObject inMemory​(java.lang.String className,
                                                                       javax.tools.JavaFileObject.Kind kind2,
                                                                       java.nio.charset.Charset charset)
        Returns:
        A JavaFileObject that stores its data in an internal byte array
      • fromResourceCreator

        public static javax.tools.JavaFileObject fromResourceCreator​(ResourceCreator resourceCreator,
                                                                     java.lang.String resourceName,
                                                                     javax.tools.JavaFileObject.Kind kind,
                                                                     java.nio.charset.Charset charset)
        Parameters:
        resourceName - E.g. "com/foo/pkg/Bar.class"
        Returns:
        A JavaFileObject that stores data through the given resourceCreator and resourceName