Class Types

java.lang.Object
eu.bandm.tools.umod.Types

public class Types extends Object
Realizes the translation from umod type expressions into Java types, and maintains the necessary caches. The meta-model elements which represent types have two main fields for their Java-representation (for declaration and for constructor calls) plus auxiliary predicates. All these fields are valid only after one (or multiple) visits by an instance of Types.JavaMapper.
  • Field Details

    • QUEST

      public static final MetaType QUEST
      The wildcard type without further constraints.
    • annotationDeprecated

      public static final GeneratedAnnotation annotationDeprecated
      The annotation »Deprecated«.
    • annotationOpt

      public static final GeneratedAnnotation annotationOpt
      The annotation »Opt«.
    • WRAPPEDCLASS_void

      protected static final MetaClass WRAPPEDCLASS_void
    • WRAPPEDCLASS_Object

      public static final EnvironmentClass WRAPPEDCLASS_Object
    • WRAPPEDCLASS_Class

      protected static final MetaClass WRAPPEDCLASS_Class
    • WRAPPEDCLASS_int

      public static final EnvironmentClass WRAPPEDCLASS_int
    • WRAPPEDCLASS_Integer

      public static final EnvironmentClass WRAPPEDCLASS_Integer
    • WRAPPEDCLASS_double

      public static final EnvironmentClass WRAPPEDCLASS_double
    • WRAPPEDCLASS_Double

      public static final EnvironmentClass WRAPPEDCLASS_Double
    • WRAPPEDCLASS_float

      public static final EnvironmentClass WRAPPEDCLASS_float
    • WRAPPEDCLASS_Float

      public static final EnvironmentClass WRAPPEDCLASS_Float
    • WRAPPEDCLASS_char

      public static final EnvironmentClass WRAPPEDCLASS_char
    • WRAPPEDCLASS_Character

      public static final EnvironmentClass WRAPPEDCLASS_Character
    • WRAPPEDCLASS_String

      public static final EnvironmentClass WRAPPEDCLASS_String
    • WRAPPEDCLASS_boolean

      public static final EnvironmentClass WRAPPEDCLASS_boolean
    • WRAPPEDCLASS_Boolean

      public static final EnvironmentClass WRAPPEDCLASS_Boolean
    • WRAPPEDCLASS_CollectionFactory

      public static final EnvironmentClass WRAPPEDCLASS_CollectionFactory
    • WRAPPEDCLASS_Optional

      public static final EnvironmentClass WRAPPEDCLASS_Optional
    • WRAPPEDCLASS_List

      public static final EnvironmentClass WRAPPEDCLASS_List
    • WRAPPEDCLASS_LinkedList

      public static final EnvironmentClass WRAPPEDCLASS_LinkedList
    • WRAPPEDCLASS_ArrayList

      public static final EnvironmentClass WRAPPEDCLASS_ArrayList
    • WRAPPEDCLASS_Format

      protected static final MetaClass WRAPPEDCLASS_Format
    • WRAPPEDCLASS_Pattern

      protected static final MetaClass WRAPPEDCLASS_Pattern
    • WRAPPEDCLASS_TotalTransform

      protected static final MetaClass WRAPPEDCLASS_TotalTransform
    • WRAPPEDCLASS_ReflectionPatterns

      protected static final MetaClass WRAPPEDCLASS_ReflectionPatterns
    • WRAPPEDCLASS_Comparable

      public static final EnvironmentClass WRAPPEDCLASS_Comparable
    • WRAPPEDCLASS_EnumSet

      public static final EnvironmentClass WRAPPEDCLASS_EnumSet
    • WRAPPEDCLASS_EnumMap

      public static final EnvironmentClass WRAPPEDCLASS_EnumMap
    • WRAPPEDCLASS_CheckedEnumMap

      public static final EnvironmentClass WRAPPEDCLASS_CheckedEnumMap
    • WRAPPEDCLASS_CheckedList

      public static final EnvironmentClass WRAPPEDCLASS_CheckedList
    • WRAPPEDCLASS_Set

      public static final EnvironmentClass WRAPPEDCLASS_Set
    • WRAPPEDCLASS_HashSet

      public static final EnvironmentClass WRAPPEDCLASS_HashSet
    • WRAPPEDCLASS_CheckedSet

      public static final EnvironmentClass WRAPPEDCLASS_CheckedSet
    • WRAPPEDCLASS_Map

      public static final EnvironmentClass WRAPPEDCLASS_Map
    • WRAPPEDCLASS_MapEntry

      protected static final MetaClass WRAPPEDCLASS_MapEntry
    • WRAPPEDCLASS_Collection

      public static final EnvironmentClass WRAPPEDCLASS_Collection
    • WRAPPEDCLASS_HashMap

      public static final EnvironmentClass WRAPPEDCLASS_HashMap
    • WRAPPEDCLASS_CheckedMap_R

      public static final EnvironmentClass WRAPPEDCLASS_CheckedMap_R
    • WRAPPEDCLASS_CheckedMap_D

      public static final EnvironmentClass WRAPPEDCLASS_CheckedMap_D
    • WRAPPEDCLASS_CheckedMap_RD

      public static final EnvironmentClass WRAPPEDCLASS_CheckedMap_RD
    • WRAPPEDCLASS_Multimap

      public static final EnvironmentClass WRAPPEDCLASS_Multimap
    • WRAPPEDCLASS_HashMultimap

      public static final EnvironmentClass WRAPPEDCLASS_HashMultimap
    • WRAPPEDCLASS_Multimaps

      public static final EnvironmentClass WRAPPEDCLASS_Multimaps
    • WRAPPEDCLASS_Pair

      public static final EnvironmentClass WRAPPEDCLASS_Pair
    • WRAPPEDCLASS_Pair_checkedLeft

      public static final EnvironmentClass WRAPPEDCLASS_Pair_checkedLeft
    • WRAPPEDCLASS_Pair_checkedRight

      public static final EnvironmentClass WRAPPEDCLASS_Pair_checkedRight
    • WRAPPEDCLASS_UncheckedPair

      public static final EnvironmentClass WRAPPEDCLASS_UncheckedPair
    • WRAPPEDCLASS_CheckedPair_L

      public static final EnvironmentClass WRAPPEDCLASS_CheckedPair_L
    • WRAPPEDCLASS_CheckedPair_R

      public static final EnvironmentClass WRAPPEDCLASS_CheckedPair_R
    • WRAPPEDCLASS_CheckedPair_LR

      public static final EnvironmentClass WRAPPEDCLASS_CheckedPair_LR
    • WRAPPEDCLASS_CoPair

      public static final EnvironmentClass WRAPPEDCLASS_CoPair
    • WRAPPEDCLASS_CoPair_checkedLeft

      public static final EnvironmentClass WRAPPEDCLASS_CoPair_checkedLeft
    • WRAPPEDCLASS_CoPair_checkedRight

      public static final EnvironmentClass WRAPPEDCLASS_CoPair_checkedRight
    • WRAPPEDCLASS_UncheckedCoPair

      public static final EnvironmentClass WRAPPEDCLASS_UncheckedCoPair
    • WRAPPEDCLASS_CheckedCoPair_L

      public static final EnvironmentClass WRAPPEDCLASS_CheckedCoPair_L
    • WRAPPEDCLASS_CheckedCoPair_R

      public static final EnvironmentClass WRAPPEDCLASS_CheckedCoPair_R
    • WRAPPEDCLASS_CheckedCoPair_LR

      public static final EnvironmentClass WRAPPEDCLASS_CheckedCoPair_LR
    • WRAPPEDCLASS_ops_Function

      protected static final MetaClass WRAPPEDCLASS_ops_Function
    • WRAPPEDCLASS_ops_Consumer

      protected static final MetaClass WRAPPEDCLASS_ops_Consumer
    • WRAPPEDCLASS_Objects

      protected static final MetaClass WRAPPEDCLASS_Objects
    • WRAPPEDCLASS_OptimizingVisitor

      protected static final MetaClass WRAPPEDCLASS_OptimizingVisitor
    • WRAPPEDCLASS_Rewriter

      protected static final MetaClass WRAPPEDCLASS_Rewriter
    • WRAPPEDCLASS_IllegalStateException

      protected static final MetaClass WRAPPEDCLASS_IllegalStateException
  • Constructor Details

    • Types

      public Types()
  • Method Details

    • compilableFieldName

      public static String compilableFieldName(UMod.FieldDef fd)
      Name of a field composed of class name and field name, which will be accepted as a field name by the Java compiler.
      Parameters:
      fd - the field
      Returns:
      a composed and compilable name
    • toplevelModif

      public static int toplevelModif(GeneratedContext context)
      Find the allowed modifier for top-level definitions. If context is not a GeneratedClass, then it is a GeneratedPackage and »static« is not allowed.
      Parameters:
      context - whereto the Java sources are generated
      Returns:
      the default modifier for top-level definitions
    • nonOpt

      public static UMod.Type nonOpt(UMod.Type t)
      Strips off all top-level »OPT« operators, delivering the highest non-opt part of type expression.
      Parameters:
      t - the type
      Returns:
      the type without any top-most »OPT« operators.
    • isOpt

      public static boolean isOpt(UMod.Type t)
      Returns whether the argument has a top-most »OPT« operator.
      Parameters:
      t - the type
      Returns:
      whether the argument has a top-most »OPT« operator.
    • isPrimitive

      public static boolean isPrimitive(UMod.Type t)
      Returns whether the argument is a primitive scalar Java type. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument is a primitive scalar Java type.
    • isBasic

      public static boolean isBasic(UMod.Type t)
      Returns whether the argument is a umod basic type (umod int, float, string, char or bool).
      Parameters:
      t - the type
      Returns:
      whether the argument is a umo basic type.
    • isExternalReferenceType

      public static boolean isExternalReferenceType(UMod.Type t)
      Returns whether the argument is an imported external class reference. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument is an imported external class reference.
    • isExternal

      public static boolean isExternal(UMod.T_reference t)
      Returns whether the argument is an imported, external class reference. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument is an imported, external class reference.
    • isTypedefReferenceType

      public static boolean isTypedefReferenceType(UMod.Type t)
      Returns whether the argument is a typedef reference. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument is a typedef reference.
    • isEnumSetType

      public static boolean isEnumSetType(UMod.Type t)
      Returns whether the argument corresponds to a set of enumeration values, defined in the meta-model source by »ENUM ...«. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument corresponds to a set of enumeration values.
    • getUmodClassDef

      @Opt public static UMod.ClassDef getUmodClassDef(UMod.Forest f, UMod.Type t)
      Returns the meta-model's class definition element to which the given type is a reference, or null. (Valid after a visit of a JavaMapper.)
      Parameters:
      f - the containing umod meta-model
      t - the type
      Returns:
      the class definitions element to which t refers, if any.
    • defaultIsEmptyCollection

      public static boolean defaultIsEmptyCollection(UMod.Type t)
      Returns whether the argument is a collection (set, seq or map). (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      whether the argument is a collection (set, seq or map).
    • hasCanonicalOrder

      public static boolean hasCanonicalOrder(UMod.Type t, UMod.Forest f, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
      Returns whether the argument comes with a canonical order. For basic types a canonical order is always defined; For basic types a canonical order is always defined; for internal definitions this depends on generated code; for external types the environment ust be asked.
      Parameters:
      t - the type
      f - the containing umod meta-model
      Returns:
      whether the argument comes with a canonical order.
    • isMapoid

      public static boolean isMapoid(UMod.Type t)
      Returns whether the argument is a map or a multi-map. An Opt operator is not considered.
      Parameters:
      t - the type
      Returns:
      whether the argument is a map or a multi-map.
    • isListoid

      public static boolean isListoid(UMod.Type t)
      Returns whether the argument is a list or a set. An Opt operator is not considered.
      Parameters:
      t - the type
      Returns:
      whether the argument is a list or a set.
    • hasVariableLength

      public static boolean hasVariableLength(UMod.Type t)
      Returns whether the argument is a map, multimap, list or a set.
      Parameters:
      t - the type
      Returns:
      whether the argument is a map, multimap, list or a set.
    • declaredMapEntryType

      public static MetaType declaredMapEntryType(UMod.T_2 t)
      Returns the class of the »Map.Entry« object for the realisation of the given umod map or relation type. (Valid after a visit of a JavaMapper.)
      Parameters:
      t - the type
      Returns:
      the class of the »Map.Entry« object.