Class TypeReferenceExtension


  • public class TypeReferenceExtension
    extends Object
    • Constructor Detail

      • TypeReferenceExtension

        public TypeReferenceExtension()
    • Method Detail

      • getTarget

        public static Type getTarget​(TypeReference me)
        Returns the type referenced by this TypeReference considering all concrete subclasses of TypeReference used by the Java meta-model.
        Parameters:
        me - the type reference to obtain the type from.
        Returns:
        the referenced type
      • setTarget

        public static void setTarget​(TypeReference me,
                                     Classifier type)
        Sets the type targeted by this type reference.
        Parameters:
        me - the type reference whose type is set.
        type - the new type to set as target.
      • getBoundTarget

        public static Type getBoundTarget​(TypeReference me,
                                          Reference reference)
        Returns the type referenced by this TypeReference considering all concrete subclasses of TypeReference used by the Java meta-model. If type parameters are bound in the given reference, the bound type will be returned instead of the parameter.
        Parameters:
        me - the type reference to obtain the type for.
        reference - the context of the type reference.
        Returns:
        the referenced type.
      • getTypeReferenceOfTypeArgument

        public static TypeReference getTypeReferenceOfTypeArgument​(TypeArgument arg)
        Returns the type reference for a type argument. If the type argument is a QualifiedTypeArgument, the returned type reference is the qualified type. If the type argument is a SuperTypeArgument, the lower bound is returned. If the type argument is an ExtendsTypeArgument, the upper bound is returned. If the type argument is an UnknownTypeArgument, null is returned.
        Parameters:
        arg - the type argument.
        Returns:
        the type reference for the type argument or null.
      • getPureClassifierReference

        public static ClassifierReference getPureClassifierReference​(TypeReference me)
        Extracts the (possibly nested) ClassifierReference (if any) from a TypeReference.
        Parameters:
        me - the TypeReference to extract the ClassifierReference from.
        Returns:
        the extracted ClassifierReference.