Class MetaType

    • Field Detail

      • MEAT_LOCKER

        private static final java.util.concurrent.locks.Lock MEAT_LOCKER
      • ROOT_TYPE

        private static final LockingLazyVar<IJavaType> ROOT_TYPE
        These fields need to be lazu vars to avoid bombarding the typesystem with calls
      • _type

        private IType _type
      • _allTypesInHierarchy

        private transient java.util.Set<IType> _allTypesInHierarchy
      • _bLiteral

        private transient boolean _bLiteral
      • _typeParams

        private transient IType[] _typeParams
      • _strName

        private transient java.lang.String _strName
      • _strRelativeName

        private transient java.lang.String _strRelativeName
    • Constructor Detail

      • MetaType

        MetaType​(IType type,
                 boolean bLiteral)
    • Method Detail

      • clearCaches

        public static void clearCaches()
      • getTypeLoader

        public ITypeLoader getTypeLoader()
        Description copied from interface: IType
        Returns the type loader responsible for loading this intrinsic type.
        Specified by:
        getTypeLoader in interface IType
      • getName

        public java.lang.String getName()
        Description copied from interface: IType
        The fully qualified name of this intrinsic type.
        Specified by:
        getName in interface IType
      • getDisplayName

        public java.lang.String getDisplayName()
        Description copied from interface: IType
        The display name of this intrinsic type. Often this is simply the same as IType.getName(), but in some cases a type may want to modify it's name for presentation to the user.
        Specified by:
        getDisplayName in interface IType
      • getRelativeName

        public java.lang.String getRelativeName()
        Description copied from interface: IType
        The relative or unqualified name. For a class this should be just the class name without the package name.
        Specified by:
        getRelativeName in interface IType
      • isDefault

        private boolean isDefault()
      • getNamespace

        public java.lang.String getNamespace()
        Description copied from interface: IType
        The namespace for this class. For a java class this will be the package, while for other types of intrinsic types it could be another logical name.
        Specified by:
        getNamespace in interface IType
      • isArray

        public boolean isArray()
        Description copied from interface: IType
        True if this is an array.
        Specified by:
        isArray in interface IType
      • isPrimitive

        public boolean isPrimitive()
        Description copied from interface: IType
        True if this type represents a primitive type e.g., Java int, char, etc.
        Specified by:
        isPrimitive in interface IType
      • makeArrayInstance

        public java.lang.Object makeArrayInstance​(int iLength)
        Description copied from interface: IType
        Construct an array instance of specified length.
        Specified by:
        makeArrayInstance in interface IType
      • isAssignableFrom

        public boolean isAssignableFrom​(IType type)
        MetaTypes are assignable if:
        • they are both arrays and their component types are assignable
        • the are not arrays and:
        • - one of them is not a MetaType and instead implements IType
        • - or - one of them is the DEFAULT_TYPE
        • - or - one of them is the ROOT_TYPE
        • - or - their core types are assignable
        • - or - their core types are structurally assignable
        Specified by:
        isAssignableFrom in interface IType
      • isMetadataType

        private boolean isMetadataType()
      • isDefaultOrRootType

        private boolean isDefaultOrRootType()
      • isMutable

        public boolean isMutable()
        Instance of this type (e.g., other types) are immutable.
        Specified by:
        isMutable in interface IType
        Returns:
        True if this type is mutable.
      • getTypeInfo

        public ITypeInfo getTypeInfo()
        Description copied from interface: IType
        Get the type information for this intrinsic type.
        Specified by:
        getTypeInfo in interface IType
        See Also:
        ITypeInfo
      • loadTypeInfo

        private ITypeInfo loadTypeInfo()
        Returns:
        One of four possible typeinfos (public, protected, package, private), depending on the accessibility of the enclosing type of the call site.
      • unloadTypeInfo

        public void unloadTypeInfo()
        Description copied from interface: IType
        Unload or nullify any references to this IType's ITypeInfo.
        Specified by:
        unloadTypeInfo in interface IType
      • isInterface

        public boolean isInterface()
        Description copied from interface: IType
        Returns true if this type is an interface.
        Specified by:
        isInterface in interface IType
      • isEnum

        public boolean isEnum()
        Description copied from interface: IType
        Returns true if this type is an enumeration.
        Specified by:
        isEnum in interface IType
      • getInterfaces

        public IType[] getInterfaces()
        Specified by:
        getInterfaces in interface IType
        Returns:
        If this is a class, returns a list of all the interfaces this type implements. Similarly, if this is an interface, returns a list of all the interfaces this type extends. In any case, returns an empty list if this type neither implements nor extends interfaces.
      • getSupertype

        public IType getSupertype()
        Description copied from interface: IType
        Returns the type representing the supertype of this type. Returns null if this type has no supertype.
        Specified by:
        getSupertype in interface IType
      • getEnclosingType

        public IType getEnclosingType()
        Description copied from interface: IType
        Returns the type immediately enclosing this type. If this type is not enclosed, returns null.
        Specified by:
        getEnclosingType in interface IType
      • getGenericType

        public IType getGenericType()
        Description copied from interface: IType
        If this is a parameterized type, returns the generic type this type parameterizes. Otherwise, returns null.
        Specified by:
        getGenericType in interface IType
      • isFinal

        public boolean isFinal()
        Description copied from interface: IType
        True if this type cannot be extended.
        Specified by:
        isFinal in interface IType
      • isParameterizedType

        public boolean isParameterizedType()
        Description copied from interface: IType
        Returns true if this ia a Parameterized Type.

        Note a Parameterzied Type is not the same as a Generic Type. The difference is that a Parameterized Type is a concrete version of a Generic Type. For instance, the class ArrayList is a Generic Type, while the class ArrayList is a Parameterized Type of the the Generic Type ArrayList.

        Specified by:
        isParameterizedType in interface IType
      • getGenericTypeVariables

        public GenericTypeVariable[] getGenericTypeVariables()
        Description copied from interface: IType
        Returns an array of GenericTypeVariables declared with this Generic Type. Otherwise, returns null if this is not a Generic Type.
        Specified by:
        getGenericTypeVariables in interface IType
      • getTypeParameters

        public IType[] getTypeParameters()
        Description copied from interface: IType
        If this is a parameterized type, returns the specific types used to create this type, null otherwies.
        Specified by:
        getTypeParameters in interface IType
      • getParameterizedType

        public IMetaType getParameterizedType​(IType... ofType)
        Description copied from interface: IType
        Assuming this intrinsic type is a Generic type, return the parameterized type associated with the given list of type parameters. If the type has not been created yet, creates the parameterized type. Successive calls to this method having identical parameter types must return the identical parameterized type.
        Specified by:
        getParameterizedType in interface IType
        Parameters:
        ofType - The type parameters.
        Returns:
        The concrete type associated with the type parameters.
      • getAllTypesInHierarchy

        public java.util.Set<? extends IType> getAllTypesInHierarchy()
        Description copied from interface: IType
        Returns a Set of all IIntrinsicTypes that this class is assignable from, including this class. This includes implemented interfaces and superclasses, recursively up the hieararchy. For array types, this will be a Set of all types that its component type is assignable from.
        Specified by:
        getAllTypesInHierarchy in interface IType
      • getTypeInterfaces

        private java.util.Set<IType> getTypeInterfaces​(IType type,
                                                       java.util.Set<IType> set)
      • getArrayType

        public IType getArrayType()
        Description copied from interface: IType
        Make an array type from this type. E.g., String -> String[]
        Specified by:
        getArrayType in interface IType
      • getArrayComponent

        public java.lang.Object getArrayComponent​(java.lang.Object array,
                                                  int iIndex)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.ArrayIndexOutOfBoundsException
        Description copied from interface: IType
        Returns the value of the indexed component in the specified array object.
        Specified by:
        getArrayComponent in interface IType
        Parameters:
        array - An array instance of this intrinsic type.
        iIndex - The index of the component to get.
        Returns:
        The value of the indexed component in the specified array.
        Throws:
        java.lang.IllegalArgumentException - If the specified object is not an array.
        java.lang.ArrayIndexOutOfBoundsException - If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
      • setArrayComponent

        public void setArrayComponent​(java.lang.Object array,
                                      int iIndex,
                                      java.lang.Object value)
                               throws java.lang.IllegalArgumentException,
                                      java.lang.ArrayIndexOutOfBoundsException
        Description copied from interface: IType
        Sets the value of the indexed component in the specified array object.
        Specified by:
        setArrayComponent in interface IType
        Parameters:
        array - An array instance of this intrinsic type.
        iIndex - The index of the component to set.
        value - The new value of the indexed component.
        Throws:
        java.lang.IllegalArgumentException - If the specified object is not an array.
        java.lang.ArrayIndexOutOfBoundsException - If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
      • getArrayLength

        public int getArrayLength​(java.lang.Object array)
                           throws java.lang.IllegalArgumentException
        Description copied from interface: IType
        Returns the length of the specified array object.
        Specified by:
        getArrayLength in interface IType
        Parameters:
        array - An array instance of this intrinsic type.
        Returns:
        The length of the array.
        Throws:
        java.lang.IllegalArgumentException - If the object argument is not an array.
      • getComponentType

        public IType getComponentType()
        Description copied from interface: IType
        If this is an array type, a type representing the component type of the array. Otherwise null.
        Specified by:
        getComponentType in interface IType
      • readResolve

        public java.lang.Object readResolve()
                                     throws java.io.ObjectStreamException
        Description copied from interface: IType
        IType requires this method be implemented to ensure IType instances can be centrally defined and cached.
        Specified by:
        readResolve in interface IType
        Throws:
        java.io.ObjectStreamException
      • isValid

        public boolean isValid()
        Description copied from interface: IType
        Defines this type if it is not yet fully defined. For instance, if this type has source code associated with it, it must fully compile the source for it to be fully defined.
        Specified by:
        isValid in interface IType
        Returns:
        true if this type is valid.
      • getModifiers

        public int getModifiers()
        Description copied from interface: IType
        Returns the modifiers for this type, encoded in an integer. The modifiers consist of the constants for public, protected, private, final, static, abstract they should be decoded using the methods of class Modifier.
        Specified by:
        getModifiers in interface IType
        See Also:
        Modifier
      • isAbstract

        public boolean isAbstract()
        Specified by:
        isAbstract in interface IType
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

        public boolean isDiscarded()
        Description copied from interface: IType
        True if this type has been replaced with a newer version of the same name in the type system.
        Specified by:
        isDiscarded in interface IType
      • setDiscarded

        public void setDiscarded​(boolean bDiscarded)
        Specified by:
        setDiscarded in interface IType
      • isCompoundType

        public boolean isCompoundType()
        Specified by:
        isCompoundType in interface IType