Package com._1c.g5.v8.dt.ql.typesystem
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 Summary
Constructors Constructor Description TypeDescriptionSource()
Constructs an empty instance of the sourceTypeDescriptionSource(TypeDescription source)
Constructs an instance of the source based on the existingTypeDescription
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearTypeItems()
Clears type items for the givenTypeDescriptionSource
static TypeDescriptionSource
clone(TypeDescriptionSource source)
Null-safe cloning of theTypeDescriptionSource
TypeDescriptionSource
cloneSource()
Clones the currentTypeDescriptionSource
completelyboolean
containsTypeItem(String typeName)
Checks if thisTypeDescriptionSource
contains the type item with the given name.static void
copyTypeQualifiers(TypeDescriptionSource srcType, TypeDescription destType)
Copy type qualifiers from the providedTypeDescriptionSource
to the destinationTypeDescription
.static boolean
equalType(TypeDescription typeF, TypeDescriptionSource typeS)
Checks if the givenTypeDescription
andTypeDescriptionSource
have equal set of type items (type qualifiers are ignored.BinaryQualifiers
getBinaryQualifiers()
Gets the binary qualifiers.DateQualifiers
getDateQualifiers()
Gets the date qualifiers.TypeItem
getFirstTypeItem()
Gets the first type item, if anyNumberQualifiers
getNumberQualifiers()
Gets the number qualifiers.StringQualifiers
getStringQualifiers()
Gets the string qualifiers.int
getTypeInfoCount()
Gets the number of type infos for this type sourceList<TypeItem>
getTypes()
Gets the current set of type itemsboolean
isEmpty()
Checks if there are no type items associated with this sourceTypeDescriptionSource
merge(TypeDescription type)
Merges the givenTypeDescription
into the current source.TypeDescriptionSource
merge(TypeDescriptionSource source)
Merges the givenTypeDescriptionSource
into the current source.static TypeDescriptionSource
merge(TypeDescriptionSource main, TypeDescriptionSource other)
Merge twoTypeDescriptionSource
instances.void
setNumberQualifiers(NumberQualifiers numQualifiers)
Sets the providedNumberQualifiers
to the source.void
setStringQualifiers(StringQualifiers stringQualifiers)
Sets the providedStringQualifiers
to the source.TypeDescription
toTypeDescription()
Creates a corresponding type description ready for insertion into any model (with cloning, etc)
-
-
-
Constructor Detail
-
TypeDescriptionSource
public TypeDescriptionSource()
Constructs an empty instance of the source
-
TypeDescriptionSource
public TypeDescriptionSource(TypeDescription source)
Constructs an instance of the source based on the existingTypeDescription
- Parameters:
source
- The sourceTypeDescription
. May not benull
-
-
Method Detail
-
copyTypeQualifiers
public static void copyTypeQualifiers(TypeDescriptionSource srcType, TypeDescription destType)
Copy type qualifiers from the providedTypeDescriptionSource
to the destinationTypeDescription
. 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 sourceTypeDescriptionSource
, may not benull
destType
- The destinationTypeDescription
, may not benull
-
clone
public static TypeDescriptionSource clone(TypeDescriptionSource source)
Null-safe cloning of theTypeDescriptionSource
- Parameters:
source
- TheTypeDescriptionSource
to clone. May benull
- 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 givenTypeDescription
andTypeDescriptionSource
have equal set of type items (type qualifiers are ignored. Null-safe variant- Parameters:
typeF
- TheTypeDescription
instance. May benull
typeS
- TheTypeDescriptionSource
instance. May benull
- Returns:
- True if types are equal. False otherwise
-
merge
public static TypeDescriptionSource merge(TypeDescriptionSource main, TypeDescriptionSource other)
Merge twoTypeDescriptionSource
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 mainTypeDescriptionSource
instance. May benull
other
- The otherTypeDescriptionSource
instance. May benull
- Returns:
- The merged instance. May be
null
in case if both input arguments arenull
-
clearTypeItems
public void clearTypeItems()
Clears type items for the givenTypeDescriptionSource
-
cloneSource
public TypeDescriptionSource cloneSource()
Clones the currentTypeDescriptionSource
completely- Returns:
- The clone of this
TypeDescriptionSource
. Nevernull
-
containsTypeItem
public boolean containsTypeItem(String typeName)
Checks if thisTypeDescriptionSource
contains the type item with the given name. Null-safe variant- Parameters:
typeName
- The name of the requiredTypeItem
. May benull
- 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
public TypeDescriptionSource merge(TypeDescription type)
Merges the givenTypeDescription
into the current source. The current source is being modified as a result of the operation- Parameters:
type
- The type to merge. May benull
- Returns:
- The resulting type. Never
null
-
merge
public TypeDescriptionSource merge(TypeDescriptionSource source)
Merges the givenTypeDescriptionSource
into the current source. The current source is being modified as a result of the operation- Parameters:
sourcee
- The type to merge. May benull
- Returns:
- The resulting type. Never
null
-
setNumberQualifiers
public void setNumberQualifiers(NumberQualifiers numQualifiers)
Sets the providedNumberQualifiers
to the source.- Parameters:
stringQualifiers
-NumberQualifiers
object. May benull
-
setStringQualifiers
public void setStringQualifiers(StringQualifiers stringQualifiers)
Sets the providedStringQualifiers
to the source.- Parameters:
stringQualifiers
-StringQualifiers
object. May benull
-
-