org.glassfish.pfl.dynamic.codegen.spi
Class Type

java.lang.Object
  extended by org.glassfish.pfl.dynamic.codegen.spi.Type

@Immutable
public class Type
extends Object

Representation of Types (no generic support) used for codegen API.

Author:
Ken Cavanaugh

Method Summary
static Type _array(Type memberType)
           
static Type _boolean()
           
static Type _byte()
           
static Type _char()
           
static Type _Class()
           
static Type _class(String name)
          Return a codegen Type representing a class with the given name.
static Type _classGenerator(ClassGenerator cg)
           
static Type _Cloneable()
           
static Type _double()
           
static Type _float()
           
static Type _int()
           
static Type _long()
           
static Type _null()
           
static Type _Object()
           
static Type _short()
           
static Type _String()
           
static Type _void()
           
 Type binaryPromotion(Type t)
          Return the type that is the binary promotion of this type and Type t.
 ClassInfo classInfo()
           
 String className()
           
static void clearCaches()
          This method is only intended for internal use.
 boolean equals(Object obj)
           
 Class<?> getTypeClass()
           
 int hashCode()
           
 boolean hasPrimitiveNarrowingConversionFrom(Type t)
          Return true iff there is a primitive narrowing conversion from Type t to this type.
 boolean hasPrimitiveWideningConversionFrom(Type t)
          Return true iff there is a primitive widening conversion from Type t to this type.
 boolean hasReferenceNarrowingConversionFrom(Type t)
          Return true iff there is a reference narrowing conversion from Type t to this type.
 boolean hasReferenceWideningConversionFrom(Type t)
          Return true iff there is a reference widening conversion from Type t to this type.
 boolean isArray()
           
 boolean isAssignmentConvertibleFrom(Type t)
          Return true iff there is an assignment conversion from Type t to this type.
 boolean isCastingConvertibleFrom(Type t)
          Return true iff there is a casting conversion from Type t to this type.
 boolean isMethodInvocationConvertibleFrom(Type t)
          Return true iff one of the following statements is true: this.equals( t ) .
 boolean isNumber()
           
 boolean isPrimitive()
           
 Type memberType()
           
 String name()
           
 String packageName()
           
 String signature()
           
 int size()
          Number of 32 bit words occupied by this type if primitive, or 0 if non-primitive.
 String toString()
           
static Type type(Class cls)
          Return the codegen Type that corresponds to the Java (non-generic) Type represented by cls.
 Type unaryPromotion()
          Return the type that is a unary promotion of this type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

clearCaches

public static final void clearCaches()
This method is only intended for internal use. It is public because the implementation that needs this is in a different package.


_array

public static Type _array(Type memberType)

_class

public static Type _class(String name)
Return a codegen Type representing a class with the given name. This is not bound to a specific Class object until/unless getTypeClass is called.


_classGenerator

public static Type _classGenerator(ClassGenerator cg)

type

public static Type type(Class cls)
Return the codegen Type that corresponds to the Java (non-generic) Type represented by cls.


_void

public static Type _void()

_null

public static Type _null()

_boolean

public static Type _boolean()

_byte

public static Type _byte()

_char

public static Type _char()

_short

public static Type _short()

_int

public static Type _int()

_long

public static Type _long()

_float

public static Type _float()

_double

public static Type _double()

_Object

public static Type _Object()

_String

public static Type _String()

_Class

public static Type _Class()

_Cloneable

public static Type _Cloneable()

isPrimitive

public boolean isPrimitive()

isArray

public boolean isArray()

memberType

public Type memberType()

size

public int size()
Number of 32 bit words occupied by this type if primitive, or 0 if non-primitive.


signature

public String signature()

name

public String name()

packageName

public String packageName()

className

public String className()

isNumber

public boolean isNumber()

getTypeClass

public Class<?> getTypeClass()

classInfo

public ClassInfo classInfo()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hasPrimitiveNarrowingConversionFrom

public boolean hasPrimitiveNarrowingConversionFrom(Type t)
Return true iff there is a primitive narrowing conversion from Type t to this type.


hasPrimitiveWideningConversionFrom

public boolean hasPrimitiveWideningConversionFrom(Type t)
Return true iff there is a primitive widening conversion from Type t to this type.


hasReferenceNarrowingConversionFrom

public boolean hasReferenceNarrowingConversionFrom(Type t)
Return true iff there is a reference narrowing conversion from Type t to this type.


hasReferenceWideningConversionFrom

public boolean hasReferenceWideningConversionFrom(Type t)
Return true iff there is a reference widening conversion from Type t to this type.


isAssignmentConvertibleFrom

public boolean isAssignmentConvertibleFrom(Type t)
Return true iff there is an assignment conversion from Type t to this type.


isCastingConvertibleFrom

public boolean isCastingConvertibleFrom(Type t)
Return true iff there is a casting conversion from Type t to this type.


unaryPromotion

public Type unaryPromotion()
Return the type that is a unary promotion of this type.


binaryPromotion

public Type binaryPromotion(Type t)
Return the type that is the binary promotion of this type and Type t.


isMethodInvocationConvertibleFrom

public boolean isMethodInvocationConvertibleFrom(Type t)
Return true iff one of the following statements is true:
  1. this.equals( t ) .
  2. There is a widening primitive conversion from Type t to this Type (see JLS 5.1.2).
  3. There is a widening reference conversion from Type t to this Type (see JLS 5.1.4).
This is similar to Class.isAssignmentCompatibleFrom, but also handles widening primitive conversions. Throws NullPointerException if t == null.



Copyright © 2013 Oracle. All Rights Reserved.