Interface ITypeSystem

  • All Known Implementing Classes:
    AbstractTypeSystem, EMFTypeSystem

    public interface ITypeSystem
    A type system represents the types (classes, or references) provided by a modeling backend.
    Since:
    2.0
    No Implement:
    Do not implement directly, rely on AbstractTypeSystem instead.
    • Method Detail

      • isConformant

        boolean isConformant​(IInputKey expectedType,
                             IInputKey actualType)
        Decides whether the second type is compatible with the first one
      • isConformToRelationColumn

        boolean isConformToRelationColumn​(IInputKey relationType,
                                          int columnIndex,
                                          IInputKey columnType)
        Decides whether the reference can have a selected type at its given column.
      • extractTypeDescriptor

        IInputKey extractTypeDescriptor​(Type type)
        Extracts the model-specific types from a Type declaration.
        Parameters:
        type - either the Type or the RelationType instance
        Returns:
        model-specific type representation
      • convertToVQLType

        default Type convertToVQLType​(org.eclipse.emf.ecore.EObject context,
                                      IInputKey key)
        Returns a new Type instance that represents the same type as the parameter input key. Each call of this method will return a new instance, and the returned type is not contained in any other EMF object, making the return type safe to include in VQL models. Not all concrete IInputKey instances are supported by this method; in case of unsupported type an IllegalArgumentException will be thrown.
        Since:
        2.2
      • convertToVQLType

        Type convertToVQLType​(org.eclipse.emf.ecore.EObject context,
                              IInputKey key,
                              boolean avoidDataType)
        Returns a new Type instance that represents the same type as the parameter input key. Each call of this method will return a new instance, and the returned type is not contained in any other EMF object, making the return type safe to include in VQL models. Not all concrete IInputKey instances are supported by this method; in case of unsupported type an IllegalArgumentException will be thrown.
        Parameters:
        avoidDataType - If set to true, data type are returned as Java types
        Since:
        2.2
      • extractColumnDescriptor

        IInputKey extractColumnDescriptor​(RelationType type,
                                          int columnIndex)
        Extracts the model-specific column type of the given index from a RelationType declaration
        Parameters:
        type -
      • minimizeTypeInformation

        java.util.Set<IInputKey> minimizeTypeInformation​(java.util.Set<IInputKey> types,
                                                         boolean mergeWithSupertypes)
        Reduces the type descriptor set by providing the most specific set of type descriptors inferrable for a selected types.
        Parameters:
        types - a collection of type definitions
        mergeWithSupertypes - if true, the collection is also minimized by calculating common supertypes
        Returns:
        the minimized set of type information
        Since:
        1.3
      • addTypeInformation

        java.util.Set<IInputKey> addTypeInformation​(java.util.Set<IInputKey> types,
                                                    IInputKey newType)
        Adds a new type descriptor to a collection of type descriptors, and minimizes it. Equivalent of calling #minimizeTypeInformation(Set) with types.add(newType), but might have a more efficient impementation.
        Parameters:
        types -
        newType -
        Returns:
        the minimized set of type information including the new type descriptor key
        Since:
        1.3
      • addTypeInformation

        java.util.Set<IInputKey> addTypeInformation​(java.util.Set<IInputKey> types,
                                                    java.util.Set<IInputKey> newTypes)
        Since:
        1.3
      • toJvmTypeReference

        org.eclipse.xtext.common.types.JvmTypeReference toJvmTypeReference​(IInputKey type,
                                                                           org.eclipse.emf.ecore.EObject context)
        Creates a type reference for model inference from a selected type.
      • fromJvmType

        JavaTransitiveInstancesKey fromJvmType​(org.eclipse.xtext.common.types.JvmType jvmType,
                                               org.eclipse.emf.ecore.EObject context)
        Creates a Java type filter IInputKey from a JVM type referenced in the pattern language.
        Since:
        2.9
      • typeString

        java.lang.String typeString​(IInputKey type)
        Converts a type object to a user-visible description string.
        Parameters:
        type - either a Type, or a model-specific type instance
        Returns:
        the string representation of the selected type
      • getCompatibleSupertypes

        java.util.Set<IInputKey> getCompatibleSupertypes​(java.util.Set<IInputKey> types)
        Returns a set of types that is a common supertype of a set of type parameters
        Since:
        1.3
      • isValidType

        boolean isValidType​(Type type)
        Returns whether the type declaration represents a valid, resolvable type for the selected type system. A null type is invalid.
        Since:
        1.4