public class ClassName extends Object
Class. Unlike Class it can also identify non existent classes (e.g.
that should be generated). On the other hand passing the qualified classname as
String around for such purpose may lead to additional parsing e.g. to extract the simple name.| Modifier and Type | Field and Description |
|---|---|
private ClassName |
enclosingClass |
private String |
packageName |
private String |
simpleName |
| Constructor and Description |
|---|
ClassName(Class<?> type)
The constructor.
|
ClassName(String packageName,
String simpleName)
The constructor.
|
ClassName(String packageName,
String simpleName,
ClassName enclosingClass)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
appendEnclosing(StringBuilder buffer,
char enclosingSeparator,
ClassName enclosing)
Appends the enclosing class in proper order
(reverse hierarchy). |
boolean |
equals(Object obj) |
String |
getCanonicalName() |
ClassName |
getEnclosingClass() |
String |
getName() |
private String |
getName(char enclosingSeparator) |
String |
getPackageName() |
String |
getSimpleName() |
int |
hashCode() |
String |
toString() |
private final String packageName
private final ClassName enclosingClass
private final String simpleName
public ClassName(String packageName, String simpleName)
packageName - - see getPackageName().simpleName - - see getSimpleName().public ClassName(String packageName, String simpleName, ClassName enclosingClass)
packageName - - see getPackageName().simpleName - - see getSimpleName().enclosingClass - - see getEnclosingClass().public ClassName getEnclosingClass()
public String getSimpleName()
simple name of the Class.public String getCanonicalName()
canonical name of the Class.private String getName(char enclosingSeparator)
enclosingSeparator - the separator for enclosing types ('.' or '$').private void appendEnclosing(StringBuilder buffer, char enclosingSeparator, ClassName enclosing)
Appends the enclosing class in proper order
(reverse hierarchy).buffer - the StringBuilder to append to.enclosingSeparator - the separator for enclosing types ('.' or '$').enclosing - the enclosing class.Copyright © 2001–2016 mmm-Team. All rights reserved.