Class OrderedClassLibraryBuilder

  • All Implemented Interfaces:
    ClassLibraryBuilder, java.io.Serializable

    public class OrderedClassLibraryBuilder
    extends java.lang.Object
    implements ClassLibraryBuilder
    This library resolves JavaClasses in the order in which class sources are added.
    Since:
    2.0
    See Also:
    Serialized Form
    • Constructor Detail

      • OrderedClassLibraryBuilder

        public OrderedClassLibraryBuilder()
        Default constructor which sets the root classLibrary to ClassNameLibrary. This way every class will be resolved, even if it's not on the classpath.
      • OrderedClassLibraryBuilder

        public OrderedClassLibraryBuilder​(AbstractClassLibrary rootClassLibrary)
        Constructor for which you can set the root ClassLibrary If you set this to null, all classes should be available on the classpath.
        Parameters:
        rootClassLibrary - the parent Classlibrary
    • Method Detail

      • appendSource

        public ClassLibraryBuilder appendSource​(java.io.InputStream stream)
                                         throws java.io.IOException
        Specified by:
        appendSource in interface ClassLibraryBuilder
        Parameters:
        stream - the Java source as stream
        Returns:
        this ClassLibraryBuilder instance
        Throws:
        java.io.IOException - if an IOException is thrown, e.g. unsupported encoding
      • appendSource

        public ClassLibraryBuilder appendSource​(java.net.URL url)
                                         throws java.io.IOException
        Specified by:
        appendSource in interface ClassLibraryBuilder
        Parameters:
        url - the Java source as URL
        Returns:
        this ClassLibraryBuilder instance
        Throws:
        java.io.IOException - if an IOException occurs
      • appendSource

        public ClassLibraryBuilder appendSource​(java.io.File file)
                                         throws java.io.IOException
        Specified by:
        appendSource in interface ClassLibraryBuilder
        Parameters:
        file - the Java source as file
        Returns:
        this ClassLibraryBuilder instance
        Throws:
        java.io.IOException - if an IOException occurs
      • addSource

        public JavaSource addSource​(java.io.InputStream stream)
                             throws java.io.IOException
        Specified by:
        addSource in interface ClassLibraryBuilder
        Parameters:
        stream - the Java source as stream
        Returns:
        the created JavaSource
        Throws:
        java.io.IOException - if an IOException is thrown, e.g. unsupported encoding
      • addSource

        public JavaSource addSource​(java.io.Reader reader)
        Description copied from interface: ClassLibraryBuilder
        Add the source content of the reader to the ClassLibrary and return the generated JavaSource
        Specified by:
        addSource in interface ClassLibraryBuilder
        Parameters:
        reader - the Java source as reader
        Returns:
        the created JavaSource
      • addSource

        public JavaSource addSource​(java.net.URL url)
                             throws java.io.IOException
        Specified by:
        addSource in interface ClassLibraryBuilder
        Parameters:
        url - the Java source as URL
        Returns:
        the created JavaSource
        Throws:
        java.io.IOException - if an IOException occurs
      • addSource

        public JavaSource addSource​(java.io.File file)
                             throws java.io.IOException
        Specified by:
        addSource in interface ClassLibraryBuilder
        Parameters:
        file - the Java source as file
        Returns:
        the created JavaSource
        Throws:
        java.io.IOException - if an IOException occurs
      • addSourceFolder

        public JavaModule addSourceFolder​(java.io.File sourceFolder)
        Specified by:
        addSourceFolder in interface ClassLibraryBuilder
        Parameters:
        sourceFolder - the sourcefolder
        Returns:
        the module info if the sourcefolder has a module-info.java, otherwise null
      • prepareSourceLibrary

        private void prepareSourceLibrary​(SourceLibrary sourceLibrary)
      • getSourceLibrary

        protected final SourceLibrary getSourceLibrary()
      • newClassLoaderLibrary

        protected ClassLoaderLibrary newClassLoaderLibrary​(AbstractClassLibrary parentLibrary)
        Ability to override the implementation of ClassLoaderLibrary
        Parameters:
        parentLibrary - the parent library
        Returns:
        a new ClassLoaderLibrary instance
        Since:
        2.0
      • newSourceLibrary

        protected SourceLibrary newSourceLibrary​(AbstractClassLibrary parentLibrary)
        Ability to override the implementation of SourceLibrary
        Parameters:
        parentLibrary - the parent library
        Returns:
        a new SourceLibrary instance
        Since:
        2.0
      • newSourceFolderLibrary

        protected SourceFolderLibrary newSourceFolderLibrary​(AbstractClassLibrary parentLibrary)
        Ability to override the implementation of SourceFolderLibrary
        Parameters:
        parentLibrary - the parent library
        Returns:
        a new SourceFolderLibrary instance
        Since:
        2.0