Top Description Inners Fields Constructors Methods
org.glassfish.pfl.dynamic.codegen.spi

public Class Type

extends Object
Class Inheritance
Annotations
@Immutable
Imports
java.lang.reflect.Modifier, java.util.Collections, .HashMap, .Map, .Set, .WeakHashMap, org.glassfish.pfl.basic.contain.Pair, org.glassfish.pfl.dynamic.codegen.impl.ClassInfoReflectiveImpl, .CurrentClassLoader, .Identifier, org.glassfish.pfl.dynamic.copyobject.spi.Immutable

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private ClassInfo
private static ThreadLocal<Map<Class<T>, Type>>
private String
private static ThreadLocal<Map<String, Type>>
private boolean
private Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private static final Type
private String
private String
private static Map<Class<T>, Type>
private String
private int
private Type.Sort
private Class<?>
private int

Constructor Summary

AccessConstructor and Description
private
Type(String name, String signature, int size, boolean isNumber, Type.Sort sort, int wideningNumber, Type memberType)

private
Type(String name, String signature, int size, boolean isNumber, Type.Sort sort, int wideningNumber)

Method Summary

Modifier and TypeMethod and Description
public static Type
_array(Type memberType)

public static Type
public static Type
public static Type
public static Type
_class(String name)

Return a codegen Type representing a class with the given name.

public static Type
public static Type
public static Type
public static Type
public static Type
public static Type
_int()

public static Type
public static Type
public static Type
public static Type
public static Type
public static Type
public Type
binaryPromotion(Type t)

Return the type that is the binary promotion of this type and Type t.

public ClassInfo
private static boolean
public String
public static final void
clearCaches()

This method is only intended for internal use.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Class<?>
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
hasPrimitiveNarrowingConversionFrom(Type t)

Return true iff there is a primitive narrowing conversion from Type t to this type.

public boolean
hasPrimitiveWideningConversionFrom(Type t)

Return true iff there is a primitive widening conversion from Type t to this type.

public boolean
hasReferenceNarrowingConversionFrom(Type t)

Return true iff there is a reference narrowing conversion from Type t to this type.

public boolean
hasReferenceWideningConversionFrom(Type t)

Return true iff there is a reference widening conversion from Type t to this type.

public boolean
public boolean
isAssignmentConvertibleFrom(Type t)

Return true iff there is an assignment conversion from Type t to this type.

public boolean
isCastingConvertibleFrom(Type t)

Return true iff there is a casting conversion from Type t to this type.

private boolean
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).
public boolean
public boolean
private boolean
public Type
private int
public String
name()

private boolean
public String
private boolean
public String
public int
size()

Number of 32 bit words occupied by this type if primitive, or 0 if non-primitive.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public static synchronized Type
type(Class<T> cls)

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

public Type
unaryPromotion()

Return the type that is a unary promotion of this type.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

classInfoback to summary
private ClassInfo classInfo
classMapback to summary
private static ThreadLocal<Map<Class<T>, Type>> classMap
classNameback to summary
private String className
classNameMapback to summary
private static ThreadLocal<Map<String, Type>> classNameMap
isNumberback to summary
private boolean isNumber
memberTypeback to summary
private Type memberType
myBooleanback to summary
private static final Type myBoolean
myByteback to summary
private static final Type myByte
myCharback to summary
private static final Type myChar
myClassback to summary
private static final Type myClass
myCloneableback to summary
private static final Type myCloneable
myDoubleback to summary
private static final Type myDouble
myFloatback to summary
private static final Type myFloat
myIntback to summary
private static final Type myInt
myLongback to summary
private static final Type myLong
myNullback to summary
private static final Type myNull
myObjectback to summary
private static final Type myObject
myShortback to summary
private static final Type myShort
myStringback to summary
private static final Type myString
myVoidback to summary
private static final Type myVoid
nameback to summary
private String name
packageNameback to summary
private String packageName
ptcToTypeback to summary
private static Map<Class<T>, Type> ptcToType
signatureback to summary
private String signature
sizeback to summary
private int size
sortback to summary
private Type.Sort sort
typeClassback to summary
private Class<?> typeClass
wideningNumberback to summary
private int wideningNumber

Constructor Detail

Typeback to summary
private Type(String name, String signature, int size, boolean isNumber, Type.Sort sort, int wideningNumber, Type memberType)
Typeback to summary
private Type(String name, String signature, int size, boolean isNumber, Type.Sort sort, int wideningNumber)

Method Detail

_arrayback to summary
public static Type _array(Type memberType)
_booleanback to summary
public static Type _boolean()
_byteback to summary
public static Type _byte()
_charback to summary
public static Type _char()
_classback to summary
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.

_Classback to summary
public static Type _Class()
_classGeneratorback to summary
public static Type _classGenerator(ClassGenerator cg)
_Cloneableback to summary
public static Type _Cloneable()
_doubleback to summary
public static Type _double()
_floatback to summary
public static Type _float()
_intback to summary
public static Type _int()
_longback to summary
public static Type _long()
_nullback to summary
public static Type _null()
_Objectback to summary
public static Type _Object()
_shortback to summary
public static Type _short()
_Stringback to summary
public static Type _String()
_voidback to summary
public static Type _void()
binaryPromotionback to summary
public Type binaryPromotion(Type t)

Return the type that is the binary promotion of this type and Type t.

classInfoback to summary
public ClassInfo classInfo()
classIsStandardback to summary
private static boolean classIsStandard(Class<T> cls)
classNameback to summary
public String className()
clearCachesback to summary
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.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getTypeClassback to summary
public Class<?> getTypeClass()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
hasPrimitiveNarrowingConversionFromback to summary
public boolean hasPrimitiveNarrowingConversionFrom(Type t)

Return true iff there is a primitive narrowing conversion from Type t to this type.

hasPrimitiveWideningConversionFromback to summary
public boolean hasPrimitiveWideningConversionFrom(Type t)

Return true iff there is a primitive widening conversion from Type t to this type.

hasReferenceNarrowingConversionFromback to summary
public boolean hasReferenceNarrowingConversionFrom(Type t)

Return true iff there is a reference narrowing conversion from Type t to this type.

hasReferenceWideningConversionFromback to summary
public boolean hasReferenceWideningConversionFrom(Type t)

Return true iff there is a reference widening conversion from Type t to this type.

isArrayback to summary
public boolean isArray()
isAssignmentConvertibleFromback to summary
public boolean isAssignmentConvertibleFrom(Type t)

Return true iff there is an assignment conversion from Type t to this type.

isCastingConvertibleFromback to summary
public boolean isCastingConvertibleFrom(Type t)

Return true iff there is a casting conversion from Type t to this type.

isInterfaceback to summary
private boolean isInterface()
isMethodInvocationConvertibleFromback to summary
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.
isNumberback to summary
public boolean isNumber()
isPrimitiveback to summary
public boolean isPrimitive()
isSubclassback to summary
private boolean isSubclass(Type t)
memberTypeback to summary
public Type memberType()
modifiersback to summary
private int modifiers()
nameback to summary
public String name()
noMethodConflictsback to summary
private boolean noMethodConflicts(Type t1, Type t2)
packageNameback to summary
public String packageName()
returnTypeCollisionback to summary
private boolean returnTypeCollision(Set<MethodInfo> set1, Set<MethodInfo> set2)
signatureback to summary
public String signature()
sizeback to summary
public int size()

Number of 32 bit words occupied by this type if primitive, or 0 if non-primitive.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
typeback to summary
public static synchronized Type type(Class<T> cls)

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

unaryPromotionback to summary
public Type unaryPromotion()

Return the type that is a unary promotion of this type.

org.glassfish.pfl.dynamic.codegen.spi back to summary

pack-priv final Enum Type.Sort

extends Enum<Type.Sort>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Type.Sort
public static final Type.Sort
public static final Type.Sort

Constructor Summary

AccessConstructor and Description
private
Sort()

Method Summary

Modifier and TypeMethod and Description
public static Type.Sort
public static Type.Sort[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ARRAYback to summary
public static final Type.Sort ARRAY
CLASSback to summary
public static final Type.Sort CLASS
PRIMITIVEback to summary
public static final Type.Sort PRIMITIVE

Constructor Detail

Sortback to summary
private Sort()

Method Detail

valueOfback to summary
public static Type.Sort valueOf(String name)
valuesback to summary
public static Type.Sort[] values()