java.lang.Object
com.thoughtworks.qdox.library.AbstractClassLibrary
- 所有已实现的接口:
ClassLibrary,Serializable
- 直接已知子类:
ClassLoaderLibrary,ClassNameLibrary,SourceLibrary
A ClassLibrary can be compared with a java classloader.
Its main task is to serve JavaClasses based on the Fully Qualified Name.
AbstractClassLibraries hold a reference a parent library, in which way they can be chained.
Besides that it contains a context only for this library.
- 从以下版本开始:
- 2.0
- 作者:
- Robert Scholte
- 另请参阅:
-
构造器概要
构造器构造器说明constructor for root ClassLibraryconstructor for chained ClassLibrary -
方法概要
修饰符和类型方法说明protected abstract booleancontainsClassReference(String name) This method is used to detect if there's a match with this classname.final JavaClassgetJavaClass(String name) First checks if there's a JavaClass available in the private context by this name.final JavaClassgetJavaClass(String name, boolean createStub) Try to retrieve the JavaClass by the (binary) name.Get all the classes of the currentAbstractClassLibrary.protected final Collection<JavaClass>getJavaClasses(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) Subclasses can call this method to gather all JavaClass object, including those from the parent.final JavaPackagegetJavaPackage(String name) Get the JavaPackage or null if it's not possibleGet all packages of the currentAbstractClassLibrary.protected final Collection<JavaPackage>getJavaPackages(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) Return all JavaSources of the current library.protected final Collection<JavaSource>getJavaSources(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) protected BuilderIf there's a modelBuilderFactory available, ask it for a new instance.protected BuildergetModelBuilder(URL url) protected final ModelBuilderFactoryprotected final ModelWriterFactorybooleanhasClassReference(String name) First checks if the context already has a JavaClass with this name.protected abstract JavaClassresolveJavaClass(String name) 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.protected abstract JavaPackageresolveJavaPackage(String name) final voidSet the ModelBuilderFactory for this classLibrary.final voidsetModelWriterFactory(ModelWriterFactory factory) Set the ModelWriterFactory for this class.
-
构造器详细资料
-
AbstractClassLibrary
public AbstractClassLibrary()constructor for root ClassLibrary -
AbstractClassLibrary
constructor for chained ClassLibrary- 参数:
parent- the parent library
-
-
方法详细资料
-
getJavaModules
- 指定者:
getJavaModules在接口中ClassLibrary
-
getJavaClass
First checks if there's a JavaClass available in the private context by this name. Otherwise try to resolve it by the concrete class. If there's still no JavaClass, ask the parent (if available) to resolve it.- 指定者:
getJavaClass在接口中ClassLibrary- 参数:
name- the binary name of the class- 返回:
- the JavaClass matching the name, otherwise
null
-
getJavaClass
从接口复制的说明:ClassLibraryTry to retrieve the JavaClass by the (binary) name. If the JavaClss doesn't exist and createStub istruemake a stub, otherwise returnnull- 指定者:
getJavaClass在接口中ClassLibrary- 参数:
name- the name of the classcreateStub- force creation of a stub if the class can't be found- 返回:
- the JavaClass, might be
nulldepending on the value of createStub.
-
resolveJavaClass
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.- 参数:
name- the fully qualified name- 返回:
- the resolved JavaClass, otherwise
null
-
getJavaSources
从接口复制的说明:ClassLibraryReturn all JavaSources of the current library. It's up to the library to decide if also collects JavaSources from it's ancestors- 指定者:
getJavaSources在接口中ClassLibrary- 返回:
- all JavaSources as a List, never
null
-
getJavaSources
protected final Collection<JavaSource> getJavaSources(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) - 参数:
filter- the classlibrary filter- 返回:
- JavaSources matching the filter
-
getJavaClasses
Get all the classes of the currentAbstractClassLibrary. Subclasses can overwrite this method by including the following codepublic List<JavaClass> getClasses() { return getJavaClasses( new ClassLibraryFilter() { public boolean accept( AbstractClassLibrary classLibrary ) { return true; } }); }This example would return all createdJavaClassobjects, including those from the classloaders.- 指定者:
getJavaClasses在接口中ClassLibrary- 返回:
- all JavaClasses of this ClassLibrary
-
getJavaClasses
protected final Collection<JavaClass> getJavaClasses(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) Subclasses can call this method to gather all JavaClass object, including those from the parent.- 参数:
filter- the classlibrary filter- 返回:
- JavaClasses matching the filter
-
getJavaPackages
Get all packages of the currentAbstractClassLibrary. Subclasses can overwrite this method by including the following codepublic List<JavaPackage> getJavaPackages() { return getJavaPackages( new ClassLibraryFilter() { public boolean accept( AbstractClassLibrary classLibrary ) { return true; } }); }This example would return all createdJavaPackageobjects, including those from the classloaders.- 指定者:
getJavaPackages在接口中ClassLibrary- 返回:
- all JavaPackages of this ClassLibrary
-
getJavaPackage
从接口复制的说明:ClassLibraryGet the JavaPackage or null if it's not possible- 指定者:
getJavaPackage在接口中ClassLibrary- 参数:
name- the fully qualified name- 返回:
- the JavaPackage matching the name, otherwise
null
-
resolveJavaPackage
-
getJavaPackages
protected final Collection<JavaPackage> getJavaPackages(com.thoughtworks.qdox.library.AbstractClassLibrary.ClassLibraryFilter filter) -
hasClassReference
First checks if the context already has a JavaClass with this name. If not, find out if this classlibrary is able to build a model for this class Otherwise ask the parent if it could build a JavaClass.- 指定者:
hasClassReference在接口中ClassLibrary- 参数:
name- the fully qualified name- 返回:
trueif there is a reference, otherwisefalse
-
containsClassReference
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.- 参数:
name- the fully qualified name of the class- 返回:
- true if this ClassLibrary has a reference to this class.
-
setModelBuilderFactory
Set the ModelBuilderFactory for this classLibrary.- 参数:
factory- the model builder factory
-
setModelWriterFactory
Set the ModelWriterFactory for this class.- 参数:
factory- the model writer factory
-
getModelWriterFactory
-
getModelBuilderFactory
-
getModelBuilder
If there's a modelBuilderFactory available, ask it for a new instance. Otherwise, return a default ModelBuilder. In both cases, pass this library as argument.- 返回:
- a new instance of a ModelBuilder, never
null
-
getModelBuilder
-