|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.generator.JavaIdentifier
This class represents a Java identifier. An identifier has a name, a type and, if it is an array, the dimension of the array. An identifier can be used to define a field, the name and return type for a method, and the name and type for a formal parameter in a method definition.
The number of constructors are meant to make it easy to define an identifier with as few statements as possible.
Constructor Summary | |
JavaIdentifier(JavaType type,
int arrayDimension,
String name)
Constructs a JavaIdentifier with the specified
type, name, and array dimension (if any). |
|
JavaIdentifier(JavaType type,
String name)
Constructs a JavaIdentifier with the specified
type and name. |
|
JavaIdentifier(String typeName,
int arrayDimension,
String name)
Constructs a JavaIdentifier with the specified
type name, identifier name,
and array dimension (if any). |
|
JavaIdentifier(String typeName,
String name)
Constructs a JavaIdentifier with the specified
type name and identifier name. |
|
JavaIdentifier(String packageName,
String typeName,
int arrayDimension,
String name)
Constructs a JavaIdentifier with the specified
package name, type name, identifier name,
and array dimension (if any). |
|
JavaIdentifier(String packageName,
String typeName,
String name)
Constructs a JavaIdentifier with the specified
package name, type name, and identifier name. |
Method Summary | |
int |
getArrayDimension()
Returns how many dimensions the array has, assuming the identifier is an array. |
JavaType |
getJavaType()
Returns the identifier's underlying type object. |
String |
getName()
Returns the identifier's name. |
String |
getPackageName()
Returns the identifier's package name. |
String |
getType()
Returns a String object representing the identifier's type. |
String |
getType(boolean includePackage)
Returns a String object representing the identifier's type. |
String |
getTypeName()
Returns the identifier's type name. |
boolean |
hasPackageName()
Returns whether the identifier has a package name or not. |
boolean |
isArray()
Returns whether the identifier is an array or not. |
String |
toString()
Returns a String object representing this JavaIdentifier. |
String |
toString(boolean includePackage)
Returns a String object representing this JavaIdentifier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JavaIdentifier(String typeName, String name)
JavaIdentifier
with the specified
type name and identifier name.
If the type name is a class name, it can include the full package name.
typeName
- The identifier's type name.name
- The identifier's name.public JavaIdentifier(JavaType type, String name)
JavaIdentifier
with the specified
type and name.
type
- The identifier's type.name
- The identifier's name.public JavaIdentifier(String packageName, String typeName, String name)
JavaIdentifier
with the specified
package name, type name, and identifier name.
packageName
- The identifier's package name.typeName
- The identifier's type name.name
- The identifier's name.public JavaIdentifier(String typeName, int arrayDimension, String name)
JavaIdentifier
with the specified
type name, identifier name,
and array dimension (if any).
If it is an array, the array dimension must be greater than zero.
If the type name is a class name, it can include the full package name.
typeName
- The identifier's type name.arrayDimension
- The number of dimensions the array has.name
- The identifier's name.public JavaIdentifier(String packageName, String typeName, int arrayDimension, String name)
JavaIdentifier
with the specified
package name, type name, identifier name,
and array dimension (if any).
If it is an array, the array dimension must be greater than zero.
packageName
- The identifier's package name.typeName
- The identifier's type name.arrayDimension
- The number of dimensions the array has.name
- The identifier's name.public JavaIdentifier(JavaType type, int arrayDimension, String name)
JavaIdentifier
with the specified
type, name, and array dimension (if any).
If it is an array, the array dimension must be greater than zero.
type
- The identifier's type.arrayDimension
- The number of dimensions the array has.name
- The identifier's name.Method Detail |
public JavaType getJavaType()
public String getType()
public String getType(boolean includePackage)
includePackage
is true, the package name is included.
If the type is an array, array brackets are included.
public boolean hasPackageName()
public String getPackageName()
public String getTypeName()
public boolean isArray()
getArrayDimension()
public int getArrayDimension()
isArray()
public String getName()
public String toString()
toString
in class Object
public String toString(boolean includePackage)
includePackage
is true, include the package name.
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |