public class DefaultJavaSource extends java.lang.Object implements JavaSource, java.io.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(java.lang.String imp) |
JavaClass |
getClassByName(java.lang.String name)
Try to get any class of this source by name.
|
java.util.List<JavaClass> |
getClasses()
A List with all direct classes of this source, never
null |
java.lang.String |
getClassNamePrefix()
If there's a package, return the packageName, followed by a dot, otherwise an empty String
|
java.lang.String |
getCodeBlock()
Complete code representation of this source
|
java.util.List<java.lang.String> |
getImports()
Retrieve all the import
|
ClassLibrary |
getJavaClassLibrary() |
JavaClass |
getNestedClassByName(java.lang.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 |
java.lang.String |
getPackageName()
Returns the name of the package or an empty String if there's no package
|
java.net.URL |
getURL() |
void |
setModelWriterFactory(ModelWriterFactory modelWriterFactory) |
void |
setPackage(JavaPackage pkg) |
void |
setURL(java.net.URL url) |
java.lang.String |
toString() |
public DefaultJavaSource(ClassLibrary classLibrary)
classLibrary - the classLibrary, should not be nullpublic void setURL(java.net.URL url)
url - the URL of the source filepublic java.net.URL getURL()
getURL in interface JavaSourcepublic JavaPackage getPackage()
nullgetPackage in interface JavaSourcepublic void setPackage(JavaPackage pkg)
public void addImport(java.lang.String imp)
public java.util.List<java.lang.String> getImports()
getImports in interface JavaSourcenullpublic void addClass(JavaClass cls)
public java.util.List<JavaClass> getClasses()
nullgetClasses in interface JavaSourcenullpublic java.lang.String getCodeBlock()
getCodeBlock in interface JavaSourcepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getClassNamePrefix()
getClassNamePrefix in interface JavaSourcepublic JavaClass getNestedClassByName(java.lang.String name)
getNestedClassByName in interface JavaSourcename - the name of the classnullpublic JavaClass getClassByName(java.lang.String name)
getClassByName in interface JavaSourcename - the (fully qualified) name of the classnullpublic ClassLibrary getJavaClassLibrary()
getJavaClassLibrary in interface JavaSourcepublic java.lang.String getPackageName()
getPackageName in interface JavaSourcepublic void setModelWriterFactory(ModelWriterFactory modelWriterFactory)
modelWriterFactory - the modelWriterFactoryCopyright © 2002-2018. All Rights Reserved.