org.mule.devkit.model.code
Class PrimitiveType

java.lang.Object
  extended by org.mule.devkit.model.code.Type
      extended by org.mule.devkit.model.code.PrimitiveType
All Implemented Interfaces:
Comparable<Type>, Generable

public final class PrimitiveType
extends Type

Java built-in primitive types.

Instances of this class can be obtained as constants of CodeModel, such as CodeModel.BOOLEAN.


Method Summary
 TypeReference array()
          Create an array type of this type.
 TypeReference boxify()
          Obtains the wrapper class for this primitive type.
 String fullName()
          Gets the full name of the type.
 void generate(Formatter f)
           
 TypeReference getWrapperClass()
          Deprecated. Use boxify().
 boolean isPrimitive()
          Tell whether or not this is a built-in primitive type, such as int or void.
 String name()
          Gets the name of this type.
 CodeModel owner()
          Gets the owner code model object.
 Type unboxify()
          Deprecated. calling this method from PrimitiveType would be meaningless, since it's always guaranteed to return this.
 GeneratedExpression unwrap(GeneratedExpression exp)
          Do the opposite of the wrap method.
 GeneratedExpression wrap(GeneratedExpression exp)
          Wraps an expression of this type to the corresponding wrapper class.
 
Methods inherited from class org.mule.devkit.model.code.Type
binaryName, compareTo, dotclass, elementType, equals, erasure, hashCode, isArray, isReference, parse, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

owner

public CodeModel owner()
Description copied from class: Type
Gets the owner code model object.

Specified by:
owner in class Type

fullName

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

See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.

Specified by:
fullName in class Type
Returns:
Strings like "int", "java.lang.String", "java.io.File[]". Never null.

name

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

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

isPrimitive

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

Overrides:
isPrimitive in class Type

array

public TypeReference array()
Description copied from class: Type
Create an array type of this type.

This method is undefined for primitive void type, which doesn't have any corresponding array representation.

Specified by:
array in class Type
Returns:
A TypeReference representing the array type whose element type is this type

boxify

public TypeReference 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.

Specified by:
boxify in class Type

unboxify

public Type unboxify()
Deprecated. calling this method from PrimitiveType would be meaningless, since it's always guaranteed to return this.

Description copied from class: Type
If this class is a wrapper type for a primitive, return the primitive type. Otherwise return this.

For example, for "java.lang.Integer", this method returns "int".

Specified by:
unboxify in class Type

getWrapperClass

public TypeReference getWrapperClass()
Deprecated. Use boxify().


wrap

public GeneratedExpression wrap(GeneratedExpression 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 GeneratedExpression unwrap(GeneratedExpression exp)
Do the opposite of the wrap method.

REVISIT: it's not clear how this method works for VOID.


generate

public void generate(Formatter f)


Copyright © 2010–2014 MuleSoft, Inc.. All rights reserved.