Class Typ


  • public class Typ
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  Typ.StringIterator  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static javax.lang.model.type.PrimitiveType Boolean  
      static javax.lang.model.type.ArrayType BooleanA  
      static javax.lang.model.type.PrimitiveType Byte  
      static javax.lang.model.type.ArrayType ByteA  
      static javax.lang.model.type.PrimitiveType Char  
      static javax.lang.model.type.ArrayType CharA  
      static javax.lang.model.type.PrimitiveType Double  
      static javax.lang.model.type.ArrayType DoubleA  
      static javax.lang.model.type.PrimitiveType Float  
      static javax.lang.model.type.ArrayType FloatA  
      static javax.lang.model.type.PrimitiveType Int  
      static javax.lang.model.type.ArrayType IntA  
      static javax.lang.model.type.PrimitiveType Long  
      static javax.lang.model.type.ArrayType LongA  
      private static javax.lang.model.util.Types myTypes  
      static javax.lang.model.type.NoType None  
      static javax.lang.model.type.NullType Null  
      static javax.lang.model.type.DeclaredType Object  
      static javax.lang.model.type.ArrayType ObjectA  
      static javax.lang.model.type.TypeMirror ReturnAddress  
      static javax.lang.model.type.PrimitiveType Short  
      static javax.lang.model.type.ArrayType ShortA  
      static javax.lang.model.type.DeclaredType String  
      static javax.lang.model.type.ArrayType StringA  
      private static javax.lang.model.util.Types types  
      static javax.lang.model.type.NoType Void  
    • Constructor Summary

      Constructors 
      Constructor Description
      Typ()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.lang.model.element.Element asElement​(javax.lang.model.type.TypeMirror t)  
      static javax.lang.model.type.TypeMirror asMemberOf​(javax.lang.model.type.DeclaredType containing, javax.lang.model.element.Element element)  
      static javax.lang.model.element.TypeElement boxedClass​(javax.lang.model.type.PrimitiveType p)  
      static javax.lang.model.type.TypeMirror capture​(javax.lang.model.type.TypeMirror t)  
      static boolean contains​(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)  
      static java.lang.Object convert​(java.lang.String constant, javax.lang.model.type.TypeKind kind)
      Returns a Object of type type converted from constant
      static java.util.List<? extends javax.lang.model.type.TypeMirror> directSupertypes​(javax.lang.model.type.TypeMirror t)  
      static javax.lang.model.type.TypeMirror erasure​(javax.lang.model.type.TypeMirror t)  
      static javax.lang.model.type.ArrayType getArrayType​(javax.lang.model.type.TypeMirror componentType)  
      static javax.lang.model.type.DeclaredType getDeclaredType​(javax.lang.model.element.TypeElement typeElem, javax.lang.model.type.TypeMirror... typeArgs)  
      static javax.lang.model.type.DeclaredType getDeclaredType​(javax.lang.model.type.DeclaredType containing, javax.lang.model.element.TypeElement typeElem, javax.lang.model.type.TypeMirror... typeArgs)  
      static int getIndexOf​(java.util.List<? extends javax.lang.model.element.VariableElement> params, int ind)  
      static java.lang.String getInternalForm​(javax.lang.model.type.TypeMirror type)  
      static int getMaxIndexOf​(java.util.List<? extends javax.lang.model.element.VariableElement> params)  
      static javax.lang.model.type.NoType getNoType​(javax.lang.model.type.TypeKind kind)  
      static javax.lang.model.type.NullType getNullType()  
      static javax.lang.model.type.PrimitiveType getPrimitiveType​(javax.lang.model.type.TypeKind kind)  
      static javax.lang.model.type.TypeMirror getTypeFor​(java.lang.Class<?> cls)  
      static javax.lang.model.type.TypeMirror getTypeFor​(java.lang.String type)  
      static int getTypeNumber​(javax.lang.model.type.TypeKind kind)
      Returns TypeKind ordinal for primitive types and DECLARED ordinal for DECLARED, ARRAY and TYPEVAR
      static javax.lang.model.type.WildcardType getWildcardType​(javax.lang.model.type.TypeMirror extendsBound, javax.lang.model.type.TypeMirror superBound)  
      static boolean isAssignable​(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)  
      static boolean isCategory2​(javax.lang.model.type.TypeMirror type)  
      static boolean isInteger​(javax.lang.model.type.TypeMirror type)
      Returns true if type is one of int, short, char, byte or boolean
      static boolean isJavaConstant​(java.lang.Object value)  
      static boolean isJavaConstantType​(javax.lang.model.type.TypeMirror type)
      Returns true if type is one of int, long, float, double or java.lang.String
      static boolean isPrimitive​(javax.lang.model.type.TypeMirror type)  
      static boolean isSameType​(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)  
      static boolean isSubsignature​(javax.lang.model.type.ExecutableType m1, javax.lang.model.type.ExecutableType m2)  
      static boolean isSubtype​(javax.lang.model.type.TypeMirror t1, javax.lang.model.type.TypeMirror t2)  
      static javax.lang.model.type.TypeMirror normalizeType​(javax.lang.model.type.TypeKind kind)
      Returns primitive type for primitive and java.lang.Object type for references
      private static javax.lang.model.type.TypeMirror parseNext​(Typ.StringIterator si)  
      private static java.lang.String parseObject​(Typ.StringIterator si)  
      static void setTypes​(javax.lang.model.util.Types types)  
      static javax.lang.model.type.TypeMirror typeFromDescriptor​(java.lang.String descriptor)  
      static javax.lang.model.type.TypeMirror typeFromSignature​(java.lang.String string)  
      static java.util.List<? extends javax.lang.model.type.TypeMirror> typesFromDescriptor​(java.lang.String descriptor)  
      static javax.lang.model.type.PrimitiveType unboxedType​(javax.lang.model.type.TypeMirror t)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • Null

        public static javax.lang.model.type.NullType Null
      • Void

        public static javax.lang.model.type.NoType Void
      • None

        public static javax.lang.model.type.NoType None
      • Byte

        public static javax.lang.model.type.PrimitiveType Byte
      • Boolean

        public static javax.lang.model.type.PrimitiveType Boolean
      • Char

        public static javax.lang.model.type.PrimitiveType Char
      • Short

        public static javax.lang.model.type.PrimitiveType Short
      • Int

        public static javax.lang.model.type.PrimitiveType Int
      • Long

        public static javax.lang.model.type.PrimitiveType Long
      • Float

        public static javax.lang.model.type.PrimitiveType Float
      • Double

        public static javax.lang.model.type.PrimitiveType Double
      • ByteA

        public static javax.lang.model.type.ArrayType ByteA
      • BooleanA

        public static javax.lang.model.type.ArrayType BooleanA
      • CharA

        public static javax.lang.model.type.ArrayType CharA
      • ShortA

        public static javax.lang.model.type.ArrayType ShortA
      • IntA

        public static javax.lang.model.type.ArrayType IntA
      • LongA

        public static javax.lang.model.type.ArrayType LongA
      • FloatA

        public static javax.lang.model.type.ArrayType FloatA
      • DoubleA

        public static javax.lang.model.type.ArrayType DoubleA
      • StringA

        public static javax.lang.model.type.ArrayType StringA
      • ObjectA

        public static javax.lang.model.type.ArrayType ObjectA
      • String

        public static javax.lang.model.type.DeclaredType String
      • Object

        public static javax.lang.model.type.DeclaredType Object
      • ReturnAddress

        public static javax.lang.model.type.TypeMirror ReturnAddress
      • myTypes

        private static final javax.lang.model.util.Types myTypes
      • types

        private static javax.lang.model.util.Types types
    • Constructor Detail

      • Typ

        public Typ()
    • Method Detail

      • setTypes

        public static void setTypes​(javax.lang.model.util.Types types)
      • getTypeNumber

        public static int getTypeNumber​(javax.lang.model.type.TypeKind kind)
        Returns TypeKind ordinal for primitive types and DECLARED ordinal for DECLARED, ARRAY and TYPEVAR
        Parameters:
        kind -
        Returns:
      • normalizeType

        public static javax.lang.model.type.TypeMirror normalizeType​(javax.lang.model.type.TypeKind kind)
        Returns primitive type for primitive and java.lang.Object type for references
        Parameters:
        kind -
        Returns:
      • isJavaConstant

        public static boolean isJavaConstant​(java.lang.Object value)
      • isPrimitive

        public static boolean isPrimitive​(javax.lang.model.type.TypeMirror type)
      • getTypeFor

        public static javax.lang.model.type.TypeMirror getTypeFor​(java.lang.Class<?> cls)
      • getTypeFor

        public static javax.lang.model.type.TypeMirror getTypeFor​(java.lang.String type)
      • getMaxIndexOf

        public static int getMaxIndexOf​(java.util.List<? extends javax.lang.model.element.VariableElement> params)
      • getIndexOf

        public static int getIndexOf​(java.util.List<? extends javax.lang.model.element.VariableElement> params,
                                     int ind)
      • isCategory2

        public static boolean isCategory2​(javax.lang.model.type.TypeMirror type)
      • typeFromDescriptor

        public static javax.lang.model.type.TypeMirror typeFromDescriptor​(java.lang.String descriptor)
      • typesFromDescriptor

        public static java.util.List<? extends javax.lang.model.type.TypeMirror> typesFromDescriptor​(java.lang.String descriptor)
      • parseNext

        private static javax.lang.model.type.TypeMirror parseNext​(Typ.StringIterator si)
      • asElement

        public static javax.lang.model.element.Element asElement​(javax.lang.model.type.TypeMirror t)
      • isSameType

        public static boolean isSameType​(javax.lang.model.type.TypeMirror t1,
                                         javax.lang.model.type.TypeMirror t2)
      • isSubtype

        public static boolean isSubtype​(javax.lang.model.type.TypeMirror t1,
                                        javax.lang.model.type.TypeMirror t2)
      • isAssignable

        public static boolean isAssignable​(javax.lang.model.type.TypeMirror t1,
                                           javax.lang.model.type.TypeMirror t2)
      • contains

        public static boolean contains​(javax.lang.model.type.TypeMirror t1,
                                       javax.lang.model.type.TypeMirror t2)
      • isSubsignature

        public static boolean isSubsignature​(javax.lang.model.type.ExecutableType m1,
                                             javax.lang.model.type.ExecutableType m2)
      • directSupertypes

        public static java.util.List<? extends javax.lang.model.type.TypeMirror> directSupertypes​(javax.lang.model.type.TypeMirror t)
      • erasure

        public static javax.lang.model.type.TypeMirror erasure​(javax.lang.model.type.TypeMirror t)
      • boxedClass

        public static javax.lang.model.element.TypeElement boxedClass​(javax.lang.model.type.PrimitiveType p)
      • unboxedType

        public static javax.lang.model.type.PrimitiveType unboxedType​(javax.lang.model.type.TypeMirror t)
      • capture

        public static javax.lang.model.type.TypeMirror capture​(javax.lang.model.type.TypeMirror t)
      • getPrimitiveType

        public static javax.lang.model.type.PrimitiveType getPrimitiveType​(javax.lang.model.type.TypeKind kind)
      • getNullType

        public static javax.lang.model.type.NullType getNullType()
      • getNoType

        public static javax.lang.model.type.NoType getNoType​(javax.lang.model.type.TypeKind kind)
      • getArrayType

        public static javax.lang.model.type.ArrayType getArrayType​(javax.lang.model.type.TypeMirror componentType)
      • getWildcardType

        public static javax.lang.model.type.WildcardType getWildcardType​(javax.lang.model.type.TypeMirror extendsBound,
                                                                         javax.lang.model.type.TypeMirror superBound)
      • getDeclaredType

        public static javax.lang.model.type.DeclaredType getDeclaredType​(javax.lang.model.element.TypeElement typeElem,
                                                                         javax.lang.model.type.TypeMirror... typeArgs)
      • getDeclaredType

        public static javax.lang.model.type.DeclaredType getDeclaredType​(javax.lang.model.type.DeclaredType containing,
                                                                         javax.lang.model.element.TypeElement typeElem,
                                                                         javax.lang.model.type.TypeMirror... typeArgs)
      • asMemberOf

        public static javax.lang.model.type.TypeMirror asMemberOf​(javax.lang.model.type.DeclaredType containing,
                                                                  javax.lang.model.element.Element element)
      • typeFromSignature

        public static javax.lang.model.type.TypeMirror typeFromSignature​(java.lang.String string)
      • isInteger

        public static boolean isInteger​(javax.lang.model.type.TypeMirror type)
        Returns true if type is one of int, short, char, byte or boolean
        Parameters:
        type -
        Returns:
      • isJavaConstantType

        public static boolean isJavaConstantType​(javax.lang.model.type.TypeMirror type)
        Returns true if type is one of int, long, float, double or java.lang.String
        Parameters:
        type -
        Returns:
      • convert

        public static java.lang.Object convert​(java.lang.String constant,
                                               javax.lang.model.type.TypeKind kind)
        Returns a Object of type type converted from constant
        Parameters:
        constant -
        kind -
        Returns:
      • getInternalForm

        public static java.lang.String getInternalForm​(javax.lang.model.type.TypeMirror type)