Class Type


  • @Immutable
    public class Type
    extends java.lang.Object
    Representation of Types (no generic support) used for codegen API.
    • Field Detail

      • name

        private java.lang.String name
      • packageName

        private java.lang.String packageName
      • className

        private java.lang.String className
      • signature

        private java.lang.String signature
      • size

        private int size
      • isNumber

        private boolean isNumber
      • wideningNumber

        private int wideningNumber
      • memberType

        private Type memberType
      • typeClass

        private java.lang.Class<?> typeClass
      • classMap

        private static java.lang.ThreadLocal<java.util.Map<java.lang.Class,​Type>> classMap
      • classNameMap

        private static java.lang.ThreadLocal<java.util.Map<java.lang.String,​Type>> classNameMap
      • ptcToType

        private static java.util.Map<java.lang.Class,​Type> ptcToType
      • myVoid

        private static final Type myVoid
      • myNull

        private static final Type myNull
      • myBoolean

        private static final Type myBoolean
      • myByte

        private static final Type myByte
      • myChar

        private static final Type myChar
      • myShort

        private static final Type myShort
      • myInt

        private static final Type myInt
      • myLong

        private static final Type myLong
      • myFloat

        private static final Type myFloat
      • myDouble

        private static final Type myDouble
      • myObject

        private static final Type myObject
      • myString

        private static final Type myString
      • myClass

        private static final Type myClass
      • myCloneable

        private static final Type myCloneable
    • Constructor Detail

      • Type

        private Type​(java.lang.String name,
                     java.lang.String signature,
                     int size,
                     boolean isNumber,
                     Type.Sort sort,
                     int wideningNumber,
                     Type memberType)
      • Type

        private Type​(java.lang.String name,
                     java.lang.String signature,
                     int size,
                     boolean isNumber,
                     Type.Sort sort,
                     int wideningNumber)
    • 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​(java.lang.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.
      • classIsStandard

        private static boolean classIsStandard​(java.lang.Class cls)
      • type

        public static Type type​(java.lang.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 java.lang.String signature()
      • name

        public java.lang.String name()
      • packageName

        public java.lang.String packageName()
      • className

        public java.lang.String className()
      • isNumber

        public boolean isNumber()
      • getTypeClass

        public java.lang.Class<?> getTypeClass()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.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.
      • returnTypeCollision

        private boolean returnTypeCollision​(java.util.Set<MethodInfo> set1,
                                            java.util.Set<MethodInfo> set2)
      • noMethodConflicts

        private boolean noMethodConflicts​(Type t1,
                                          Type t2)
      • isSubclass

        private boolean isSubclass​(Type t)
      • isInterface

        private boolean isInterface()
      • modifiers

        private int modifiers()
      • 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.