Package com.thoughtworks.qdox.model.impl
Class DefaultJavaSource
java.lang.Object
com.thoughtworks.qdox.model.impl.DefaultJavaSource
- All Implemented Interfaces:
JavaSource
,Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassLibrary
private ModelWriterFactory
private JavaPackage
private URL
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJavaSource
(ClassLibrary classLibrary) Default constructor for the Default JavaSource -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
getClassByName
(String name) Try to get any class of this source by name.A List with all direct classes of this source, nevernull
If there's a package, return the packageName, followed by a dot, otherwise an empty StringComplete code representation of this sourceRetrieve all the importprivate ModelWriter
getNestedClassByName
(String name) Try to get the JavaClass child based on its name relative to the package.The package of this source ornull
Returns the name of the package or an empty String if there's no packagegetURL()
void
setModelWriterFactory
(ModelWriterFactory modelWriterFactory) void
setPackage
(JavaPackage pkg) void
toString()
-
Field Details
-
classLibrary
-
modelWriterFactory
-
pkg
-
imports
-
classes
-
url
-
-
Constructor Details
-
DefaultJavaSource
Default constructor for the Default JavaSource- Parameters:
classLibrary
- the classLibrary, should not benull
-
-
Method Details
-
setURL
- Parameters:
url
- the URL of the source file- Since:
- 1.4
-
getURL
- Specified by:
getURL
in interfaceJavaSource
- Returns:
- the URL of the source file
-
getPackage
The package of this source ornull
- Specified by:
getPackage
in interfaceJavaSource
- Returns:
- the package
-
setPackage
-
addImport
-
getImports
Retrieve all the import- Specified by:
getImports
in interfaceJavaSource
- Returns:
- the imports, never
null
-
addClass
-
getClasses
A List with all direct classes of this source, nevernull
- Specified by:
getClasses
in interfaceJavaSource
- Returns:
- a list of JavaClasses, never
null
-
getCodeBlock
Complete code representation of this source- Specified by:
getCodeBlock
in interfaceJavaSource
- Returns:
- the code block of this source
-
toString
-
getClassNamePrefix
If there's a package, return the packageName, followed by a dot, otherwise an empty String- Specified by:
getClassNamePrefix
in interfaceJavaSource
- Returns:
- the class name prefix, otherwise an empty String
-
getNestedClassByName
Try to get the JavaClass child based on its name relative to the package. This doesn't try to resolve it by recursion.- Specified by:
getNestedClassByName
in interfaceJavaSource
- Parameters:
name
- the name of the class- Returns:
- the resolved JavaClass, otherwise
null
-
getClassByName
Try to get any class of this source by name. The name can be both the fully qualified name or just the name of the class.- Specified by:
getClassByName
in interfaceJavaSource
- Parameters:
name
- the (fully qualified) name of the class- Returns:
- the matching class, otherwise
null
-
getJavaClassLibrary
- Specified by:
getJavaClassLibrary
in interfaceJavaSource
-
getPackageName
Returns the name of the package or an empty String if there's no package- Specified by:
getPackageName
in interfaceJavaSource
- Returns:
- the package name, otherwise an empty String
-
setModelWriterFactory
- Parameters:
modelWriterFactory
- the modelWriterFactory- Since:
- 2.0
-
getModelWriter
-