public final class NestedClass extends Object
NestedClass
can be used to represent nested classes within parent class
Example:
If we have following structure: ParentClass (parent-of) ChildClass1 (parent-of) ChildClass2,
for ChildClass1 className field would contain "ChildClass1" and topLevelClassName would contain "ParentClass",
for ChildClass2 className field would contain "ChildClass1.ChildClass2" and topLevelClassName would contain "ParentClass"
Constructor and Description |
---|
NestedClass(String className,
String topLevelClassName,
FileObject file)
Creates a new instance holding the specified identification
of a nested class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getClassName()
Returns name of a nested class within a file.
|
FileObject |
getFile()
Returns the file identification.
|
String |
getFQN(String packageName)
Returns fully qualified name.
|
String |
getFQN(String packageName,
String nestedClassSeparator)
Returns fully qualified name.
|
String |
getTopLevelClassName()
Returns name of a top level class within a file.
|
int |
hashCode() |
public NestedClass(String className, String topLevelClassName, FileObject file)
className
- name of a class inside the filetopLevelClassName
- top level name of a class inside the filefile
- file to be kept in the objectIllegalArgumentException
- if the file or class name is null
public FileObject getFile()
public String getClassName()
public String getTopLevelClassName()
public String getFQN(String packageName)
packageName
- name of the package where the class ispublic String getFQN(String packageName, String nestedClassSeparator)
packageName
- name of the package where the class isnestedClassSeparator
- separator for the nested classes