类 SourceLibrary

java.lang.Object
com.thoughtworks.qdox.library.AbstractClassLibrary
com.thoughtworks.qdox.library.SourceLibrary
所有已实现的接口:
ClassLibrary, Serializable
直接已知子类:
SourceFolderLibrary

public class SourceLibrary extends AbstractClassLibrary
This Library will immediately parse the source and keeps its reference to a private context. Once the superclass explicitly asks for an instance if will be moved to the context f the supoerclass. If there's a request to get a certain JavaModel Object from a SourceLibrary, it will check all ancestor SourceLibraries as well.
从以下版本开始:
2.0
作者:
Robert Scholte
另请参阅:
  • 构造器详细资料

    • SourceLibrary

      public SourceLibrary(AbstractClassLibrary parent)
      Create a new instance of SourceLibrary and chain it to the parent
      参数:
      parent - the parent classLibrary
  • 方法详细资料

    • addSource

      public JavaSource addSource(Reader reader) throws ParseException
      Add a Reader containing java code to this library
      参数:
      reader - a Reader which should contain java code
      返回:
      The constructed JavaSource object of this reader
      抛出:
      ParseException - if this content couldn't be parsed to a JavaModel
    • addSource

      public JavaSource addSource(InputStream stream) throws ParseException, IOException
      Add an InputStream containing java code to this library
      参数:
      stream - an InputStream which should contain java code
      返回:
      The constructed JavaSource object of this stream
      抛出:
      ParseException - if this content couldn't be parsed to a JavaModel
      IOException - if an IOException occurs
    • addSource

      public JavaSource addSource(URL url) throws ParseException, IOException
      Add a URL containing java code to this library
      参数:
      url - a URL which should contain java code
      返回:
      The constructed JavaSource object of this url
      抛出:
      ParseException - if this content couldn't be parsed to a JavaModel
      IOException - if an IOException occurs
    • addSource

      public JavaSource addSource(File file) throws ParseException, IOException
      Add a File containing java code to this library
      参数:
      file - a File which should contain java code
      返回:
      The constructed JavaSource object of this file
      抛出:
      ParseException - if this content couldn't be parsed to a JavaModel
      IOException - if an IOException occurs
    • resolveJavaClass

      protected JavaClass resolveJavaClass(String name)
      从类复制的说明: AbstractClassLibrary
      The implementation should check it's sources to see if it can build a JavaClass Model If not, just return null; Once found it will be mapped, so there's no need to keep a reference to this object.
      指定者:
      resolveJavaClass 在类中 AbstractClassLibrary
      参数:
      name - the fully qualified name
      返回:
      the resolved JavaClass, otherwise null
    • resolveJavaPackage

      protected JavaPackage resolveJavaPackage(String name)
      指定者:
      resolveJavaPackage 在类中 AbstractClassLibrary
    • registerJavaSource

      protected final void registerJavaSource(JavaSource source)
      参数:
      source - the source, might be null
    • setDebugLexer

      public final void setDebugLexer(boolean debugLexer)
      Use the Lexer in debug mode
      参数:
      debugLexer - the debug logging flag
    • isDebugLexer

      public final boolean isDebugLexer()
    • setDebugParser

      public final void setDebugParser(boolean debugParser)
      Use the Parser in debug mode
      参数:
      debugParser - the debug logging flag
    • isDebugParser

      public final boolean isDebugParser()
    • setEncoding

      public final void setEncoding(String encoding)
      Sets the encoding to use when parsing a URL or InputStreamReader
      参数:
      encoding - the source encoding
    • getEncoding

      public final String getEncoding()
    • setErrorHandler

      public final void setErrorHandler(ErrorHandler errorHandler)
    • getErrorHandler

      public final ErrorHandler getErrorHandler()
    • getJavaClasses

      public Collection<JavaClass> getJavaClasses()
      Get all classes, including those from parent SourceLibraries
      指定者:
      getJavaClasses 在接口中 ClassLibrary
      覆盖:
      getJavaClasses 在类中 AbstractClassLibrary
      返回:
      all JavaClasses of this ClassLibrary
    • getJavaPackages

      public Collection<JavaPackage> getJavaPackages()
      Get all packages, including those from parent SourceLibraries
      指定者:
      getJavaPackages 在接口中 ClassLibrary
      覆盖:
      getJavaPackages 在类中 AbstractClassLibrary
      返回:
      all JavaPackages of this ClassLibrary
    • getJavaSources

      public Collection<JavaSource> getJavaSources()
      Get all sources, including those from parent SourceLibraries
      指定者:
      getJavaSources 在接口中 ClassLibrary
      覆盖:
      getJavaSources 在类中 AbstractClassLibrary
      返回:
      all JavaSources as a List, never null
    • containsClassReference

      protected boolean containsClassReference(String name)
      从类复制的说明: AbstractClassLibrary
      This method is used to detect if there's a match with this classname. The name could be constructed based on imports and inner class paths.
      指定者:
      containsClassReference 在类中 AbstractClassLibrary
      参数:
      name - the fully qualified name of the class
      返回:
      true if this ClassLibrary has a reference to this class.