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 nullpublic void setURL(URL url)
url - the URL of the source filepublic URL getURL()
getURL in interface JavaSourcepublic JavaPackage getPackage()
nullgetPackage in interface JavaSourcepublic void setPackage(JavaPackage pkg)
public void addImport(String imp)
public List<String> getImports()
getImports in interface JavaSourcenullpublic void addClass(JavaClass cls)
public List<JavaClass> getClasses()
nullgetClasses in interface JavaSourcenullpublic String getCodeBlock()
getCodeBlock in interface JavaSourcepublic String getClassNamePrefix()
getClassNamePrefix in interface JavaSourcepublic JavaClass getNestedClassByName(String name)
getNestedClassByName in interface JavaSourcename - the name of the classnullpublic JavaClass getClassByName(String name)
getClassByName in interface JavaSourcename - the (fully qualified) name of the classnullpublic ClassLibrary getJavaClassLibrary()
getJavaClassLibrary in interface JavaSourcepublic String getPackageName()
getPackageName in interface JavaSourcepublic void setModelWriterFactory(ModelWriterFactory modelWriterFactory)
modelWriterFactory - the modelWriterFactoryCopyright © 2002–2025. All rights reserved.