Class TypeReferenceExtension

java.lang.Object
org.emftext.language.java.extensions.types.TypeReferenceExtension

public class TypeReferenceExtension extends Object
  • Constructor Details

    • TypeReferenceExtension

      public TypeReferenceExtension()
  • Method Details

    • 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.
    • getBoundTargetReference

      public static TypeReference getBoundTargetReference(TypeReference me, Reference reference)
    • getTypeReferenceOfTypeArgument

      public static TypeReference getTypeReferenceOfTypeArgument(TypeReference ref, int index)
    • 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.
    • convertToTypeReference

      public static TypeReference convertToTypeReference(EObject obj)
    • clone

      public static TypeReference clone(TypeReference me)
    • 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.