public class DefaultJavaSource extends Object implements JavaSource, Serializable
Constructor and Description |
---|
DefaultJavaSource(ClassLibrary classLibrary)
Default constructor for the Default JavaSource
|
Modifier and Type | Method and Description |
---|---|
void |
addClass(JavaClass cls) |
void |
addImport(String imp) |
JavaClass |
getClassByName(String name)
Try to get any class of this source by name.
|
List<JavaClass> |
getClasses()
A List with all direct classes of this source, never
null |
String |
getClassNamePrefix()
If there's a package, return the packageName, followed by a dot, otherwise an empty String
|
String |
getCodeBlock()
Complete code representation of this source
|
List<String> |
getImports()
Retrieve all the import
|
ClassLibrary |
getJavaClassLibrary() |
JavaClass |
getNestedClassByName(String name)
Try to get the JavaClass child based on its name relative to the package.
|
JavaPackage |
getPackage()
The package of this source or
null |
String |
getPackageName()
Returns the name of the package or an empty String if there's no package
|
URL |
getURL() |
void |
setModelWriterFactory(ModelWriterFactory modelWriterFactory) |
void |
setPackage(JavaPackage pkg) |
void |
setURL(URL url) |
String |
toString() |
public DefaultJavaSource(ClassLibrary classLibrary)
classLibrary
- the classLibrary, should not be null
public void setURL(URL url)
url
- the URL of the source filepublic URL getURL()
getURL
in interface JavaSource
public JavaPackage getPackage()
null
getPackage
in interface JavaSource
public void setPackage(JavaPackage pkg)
public void addImport(String imp)
public List<String> getImports()
getImports
in interface JavaSource
null
public void addClass(JavaClass cls)
public List<JavaClass> getClasses()
null
getClasses
in interface JavaSource
null
public String getCodeBlock()
getCodeBlock
in interface JavaSource
public String getClassNamePrefix()
getClassNamePrefix
in interface JavaSource
public JavaClass getNestedClassByName(String name)
getNestedClassByName
in interface JavaSource
name
- the name of the classnull
public JavaClass getClassByName(String name)
getClassByName
in interface JavaSource
name
- the (fully qualified) name of the classnull
public ClassLibrary getJavaClassLibrary()
getJavaClassLibrary
in interface JavaSource
public String getPackageName()
getPackageName
in interface JavaSource
public void setModelWriterFactory(ModelWriterFactory modelWriterFactory)
modelWriterFactory
- the modelWriterFactoryCopyright © 2002–2022. All rights reserved.