Package com.sun.codemodel
Class JPrimitiveType
- java.lang.Object
-
- com.sun.codemodel.JType
-
- com.sun.codemodel.JPrimitiveType
-
- All Implemented Interfaces:
JGenerable,Comparable<JType>
public final class JPrimitiveType extends JType
Java built-in primitive types. Instances of this class can be obtained as constants ofJCodeModel, such asJCodeModel.BOOLEAN.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JClassarray()Create an array type of this type.JClassboxify()Obtains the wrapper class for this primitive type.StringfullName()Gets the full name of the type.voidgenerate(JFormatter f)JClassgetWrapperClass()Deprecated.Useboxify().booleanisPrimitive()Tell whether or not this is a built-in primitive type, such as int or void.Stringname()Gets the name of this type.JCodeModelowner()Gets the owner code model object.JTypeunboxify()Deprecated.calling this method fromJPrimitiveTypewould be meaningless, since it's always guaranteed to returnthis.JExpressionunwrap(JExpression exp)Do the opposite of the wrap method.JExpressionwrap(JExpression exp)Wraps an expression of this type to the corresponding wrapper class.-
Methods inherited from class com.sun.codemodel.JType
binaryName, compareTo, elementType, erasure, isArray, isReference, parse, toString
-
-
-
-
Method Detail
-
owner
public JCodeModel owner()
Description copied from class:JTypeGets the owner code model object.
-
fullName
public String fullName()
Description copied from class:JTypeGets the full name of the type. See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.
-
isPrimitive
public boolean isPrimitive()
Description copied from class:JTypeTell whether or not this is a built-in primitive type, such as int or void.- Overrides:
isPrimitivein classJType
-
array
public JClass array()
Description copied from class:JTypeCreate an array type of this type. This method is undefined for primitive void type, which doesn't have any corresponding array representation.
-
boxify
public JClass boxify()
Obtains the wrapper class for this primitive type. For example, this method returns a reference to java.lang.Integer if this object represents int.
-
unboxify
@Deprecated public JType unboxify()
Deprecated.calling this method fromJPrimitiveTypewould be meaningless, since it's always guaranteed to returnthis.Description copied from class:JTypeIf this class is a wrapper type for a primitive, return the primitive type. Otherwise returnthis.For example, for "java.lang.Integer", this method returns "int".
-
getWrapperClass
@Deprecated public JClass getWrapperClass()
Deprecated.Useboxify().
-
wrap
public JExpression wrap(JExpression exp)
Wraps an expression of this type to the corresponding wrapper class. For example, if this class represents "float", this method will return the expressionnew Float(x)for the paramter x. REVISIT: it's not clear how this method works for VOID.
-
unwrap
public JExpression unwrap(JExpression exp)
Do the opposite of the wrap method. REVISIT: it's not clear how this method works for VOID.
-
generate
public void generate(JFormatter f)
-
-