Class TypeDescriptionSource

java.lang.Object
com._1c.g5.v8.dt.ql.typesystem.TypeDescriptionSource

public class TypeDescriptionSource extends Object
DTO/data collector for the mutable type description being based on some existing type instance. Allows to expand the type set of the given type in a safe manner without a significant overhead of type cloning
  • Constructor Details

    • TypeDescriptionSource

      public TypeDescriptionSource()
      Constructs an empty instance of the source
    • TypeDescriptionSource

      public TypeDescriptionSource(TypeDescription source)
      Constructs an instance of the source based on the existing TypeDescription
      Parameters:
      source - The source TypeDescription. May not be null
  • Method Details

    • copyTypeQualifiers

      public static void copyTypeQualifiers(TypeDescriptionSource srcType, TypeDescription destType)
      Copy type qualifiers from the provided TypeDescriptionSource to the destination TypeDescription. The copied data are being cloned during the copying so it's safe to use this type after the copying procedure ends
      Parameters:
      srcType - The source TypeDescriptionSource, may not be null
      destType - The destination TypeDescription, may not be null
    • clone

      public static TypeDescriptionSource clone(TypeDescriptionSource source)
      Null-safe cloning of the TypeDescriptionSource
      Parameters:
      source - The TypeDescriptionSource to clone. May be null
      Returns:
      The cloned source. May be null in case of no source is given as input
    • equalType

      public static boolean equalType(TypeDescription typeF, TypeDescriptionSource typeS)
      Checks if the given TypeDescription and TypeDescriptionSource have equal set of type items (type qualifiers are ignored. Null-safe variant
      Parameters:
      typeF - The TypeDescription instance. May be null
      typeS - The TypeDescriptionSource instance. May be null
      Returns:
      True if types are equal. False otherwise
    • merge

      Merge two TypeDescriptionSource instances. In case if the main instance is present it serves as a destination for the merge and being modified during the merge. In case if the main instance is absent - creates the copy of the second instance. Null-safe variant
      Parameters:
      main - The main TypeDescriptionSource instance. May be null
      other - The other TypeDescriptionSource instance. May be null
      Returns:
      The merged instance. May be null in case if both input arguments are null
    • clearTypeItems

      public void clearTypeItems()
      Clears type items for the given TypeDescriptionSource
    • cloneSource

      public TypeDescriptionSource cloneSource()
      Clones the current TypeDescriptionSource completely
      Returns:
      The clone of this TypeDescriptionSource. Never null
    • containsTypeItem

      public boolean containsTypeItem(String typeName)
      Checks if this TypeDescriptionSource contains the type item with the given name. Null-safe variant
      Parameters:
      typeName - The name of the required TypeItem. May be null
      Returns:
      True if the corresponding type item is found
    • getBinaryQualifiers

      public BinaryQualifiers getBinaryQualifiers()
      Gets the binary qualifiers. The qualifiers are returned as-is, so one should clone them in case of other type insertion, etc
      Returns:
      The binary qualifiers. May be null
    • getDateQualifiers

      public DateQualifiers getDateQualifiers()
      Gets the date qualifiers. The qualifiers are returned as-is, so one should clone them in case of other type insertion, etc
      Returns:
      The date qualifiers. May be null
    • getFirstTypeItem

      public TypeItem getFirstTypeItem()
      Gets the first type item, if any
      Returns:
      The first TypeItem if any. null otherwise
    • getNumberQualifiers

      public NumberQualifiers getNumberQualifiers()
      Gets the number qualifiers. The qualifiers are returned as-is, so one should clone them in case of other type insertion, etc
      Returns:
      The number qualifiers. May be null
    • getStringQualifiers

      public StringQualifiers getStringQualifiers()
      Gets the string qualifiers. The qualifiers are returned as-is, so one should clone them in case of other type insertion, etc
      Returns:
      The string qualifiers. May be null
    • getTypeInfoCount

      public int getTypeInfoCount()
      Gets the number of type infos for this type source
      Returns:
      The number of type infos
    • getTypes

      public List<TypeItem> getTypes()
      Gets the current set of type items
      Returns:
      The type items of this source. May not be null
    • toTypeDescription

      public TypeDescription toTypeDescription()
      Creates a corresponding type description ready for insertion into any model (with cloning, etc)
      Returns:
      The final type descrion. May not be null
    • isEmpty

      public boolean isEmpty()
      Checks if there are no type items associated with this source
      Returns:
      True if the type source is empty
    • merge

      Merges the given TypeDescription into the current source. The current source is being modified as a result of the operation
      Parameters:
      type - The type to merge. May be null
      Returns:
      The resulting type. Never null
    • merge

      Merges the given TypeDescriptionSource into the current source. The current source is being modified as a result of the operation
      Parameters:
      sourcee - The type to merge. May be null
      Returns:
      The resulting type. Never null
    • setNumberQualifiers

      public void setNumberQualifiers(NumberQualifiers numQualifiers)
      Sets the provided NumberQualifiers to the source.
      Parameters:
      stringQualifiers - NumberQualifiers object. May be null
    • setStringQualifiers

      public void setStringQualifiers(StringQualifiers stringQualifiers)
      Sets the provided StringQualifiers to the source.
      Parameters:
      stringQualifiers - StringQualifiers object. May be null