public final class JPrimitiveType extends JType
JDeparser
,
such as JDeparser.BOOLEAN
.Modifier and Type | Field and Description |
---|---|
private JClass |
arrayClass |
private JDeparser |
owner |
private java.lang.String |
typeName |
private JClass |
wrapperClass
Corresponding wrapper class.
|
Constructor and Description |
---|
JPrimitiveType(JDeparser owner,
java.lang.String typeName,
java.lang.Class<?> wrapper) |
Modifier and Type | Method and Description |
---|---|
JClass |
array()
Create an array type of this type.
|
JClass |
boxify()
Obtains the wrapper class for this primitive type.
|
java.lang.String |
fullName()
Gets the full name of the type.
|
void |
generate(JFormatter f) |
JClass |
getWrapperClass()
Deprecated.
Use
boxify() . |
boolean |
isPrimitive()
Tell whether or not this is a built-in primitive type, such as int or void.
|
java.lang.String |
name()
Gets the name of this type.
|
JDeparser |
owner()
Gets the owner code model object.
|
JType |
unboxify()
Deprecated.
calling this method from
JPrimitiveType
would be meaningless, since it's always guaranteed to
return this. |
JExpression |
unwrap(JExpression exp)
Do the opposite of the wrap method.
|
JExpression |
wrap(JExpression exp)
Wraps an expression of this type to the corresponding wrapper class.
|
binaryName, compareTo, elementType, erasure, isArray, isReference, parse, toString
private final java.lang.String typeName
private final JDeparser owner
private final JClass wrapperClass
private JClass arrayClass
JPrimitiveType(JDeparser owner, java.lang.String typeName, java.lang.Class<?> wrapper)
public JDeparser owner()
JType
public java.lang.String fullName()
JType
public java.lang.String name()
JType
public boolean isPrimitive()
JType
isPrimitive
in class JType
public JClass array()
JType
public JClass boxify()
public JType unboxify()
JPrimitiveType
would be meaningless, since it's always guaranteed to
return this.JType
For example, for "java.lang.Integer", this method returns "int".
public JExpression wrap(JExpression exp)
new Float(x)
for the paramter x.
REVISIT: it's not clear how this method works for VOID.public JExpression unwrap(JExpression exp)
public void generate(JFormatter f)