com.sun.codemodel
Class JPrimitiveType

java.lang.Object
  extended by com.sun.codemodel.JType
      extended by com.sun.codemodel.JPrimitiveType

public final class JPrimitiveType
extends JType

Java built-in primitive types.


Method Summary
 JClass array()
          Create an array type from this type.
 java.lang.String fullName()
          Gets the full name of the type
 void generate(JFormatter f)
           
 JClass getWrapperClass()
          Obtains the wrapper class for this primitive type.
 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.
 JCodeModel owner()
          Gets the owner code model object.
 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.
 
Methods inherited from class com.sun.codemodel.JType
binaryName, elementType, isArray, isReference, parse, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

owner

public JCodeModel owner()
Description copied from class: JType
Gets the owner code model object.

Specified by:
owner in class JType

fullName

public java.lang.String fullName()
Description copied from class: JType
Gets the full name of the type

Specified by:
fullName in class JType

name

public java.lang.String name()
Description copied from class: JType
Gets the name of this type.

Specified by:
name in class JType
Returns:
Names like "int", "void", "BigInteger".

isPrimitive

public boolean isPrimitive()
Description copied from class: JType
Tell whether or not this is a built-in primitive type, such as int or void.

Overrides:
isPrimitive in class JType

array

public JClass array()
Description copied from class: JType
Create an array type from this type. This method is undefined for primitive void type, which doesn't have any corresponding array representation.

Specified by:
array in class JType
Returns:
A JType representing the one-dimensional array type whose element type is this type

getWrapperClass

public JClass getWrapperClass()
Obtains the wrapper class for this primitive type. For example, this method returns a reference to java.lang.Integer if this object represents int.


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 expression new 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)