Package com._1c.g5.v8.dt.ql.typesystem
Class TypeDescriptionSource
java.lang.Object
com._1c.g5.v8.dt.ql.typesystem.TypeDescriptionSource
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
ConstructorsConstructorDescriptionConstructs an empty instance of the sourceTypeDescriptionSource(TypeDescription source) Constructs an instance of the source based on the existingTypeDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidClears type items for the givenTypeDescriptionSourcestatic TypeDescriptionSourceclone(TypeDescriptionSource source) Null-safe cloning of theTypeDescriptionSourceClones the currentTypeDescriptionSourcecompletelybooleancontainsTypeItem(String typeName) Checks if thisTypeDescriptionSourcecontains the type item with the given name.static voidcopyTypeQualifiers(TypeDescriptionSource srcType, TypeDescription destType) Copy type qualifiers from the providedTypeDescriptionSourceto the destinationTypeDescription.static booleanequalType(TypeDescription typeF, TypeDescriptionSource typeS) Checks if the givenTypeDescriptionandTypeDescriptionSourcehave equal set of type items (type qualifiers are ignored.Gets the binary qualifiers.Gets the date qualifiers.Gets the first type item, if anyGets the number qualifiers.Gets the string qualifiers.intGets the number of type infos for this type sourcegetTypes()Gets the current set of type itemsbooleanisEmpty()Checks if there are no type items associated with this sourcemerge(TypeDescription type) Merges the givenTypeDescriptioninto the current source.merge(TypeDescriptionSource source) Merges the givenTypeDescriptionSourceinto the current source.static TypeDescriptionSourcemerge(TypeDescriptionSource main, TypeDescriptionSource other) Merge twoTypeDescriptionSourceinstances.voidsetNumberQualifiers(NumberQualifiers numQualifiers) Sets the providedNumberQualifiersto the source.voidsetStringQualifiers(StringQualifiers stringQualifiers) Sets the providedStringQualifiersto the source.Creates a corresponding type description ready for insertion into any model (with cloning, etc)
-
Constructor Details
-
TypeDescriptionSource
public TypeDescriptionSource()Constructs an empty instance of the source -
TypeDescriptionSource
Constructs an instance of the source based on the existingTypeDescription- Parameters:
source- The sourceTypeDescription. May not benull
-
-
Method Details
-
copyTypeQualifiers
Copy type qualifiers from the providedTypeDescriptionSourceto 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 benulldestType- The destinationTypeDescription, may not benull
-
clone
Null-safe cloning of theTypeDescriptionSource- Parameters:
source- TheTypeDescriptionSourceto clone. May benull- Returns:
- The cloned source. May be
nullin case of no source is given as input
-
equalType
Checks if the givenTypeDescriptionandTypeDescriptionSourcehave equal set of type items (type qualifiers are ignored. Null-safe variant- Parameters:
typeF- TheTypeDescriptioninstance. May benulltypeS- TheTypeDescriptionSourceinstance. May benull- Returns:
- True if types are equal. False otherwise
-
merge
Merge twoTypeDescriptionSourceinstances. 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 mainTypeDescriptionSourceinstance. May benullother- The otherTypeDescriptionSourceinstance. May benull- Returns:
- The merged instance. May be
nullin case if both input arguments arenull
-
clearTypeItems
public void clearTypeItems()Clears type items for the givenTypeDescriptionSource -
cloneSource
Clones the currentTypeDescriptionSourcecompletely- Returns:
- The clone of this
TypeDescriptionSource. Nevernull
-
containsTypeItem
Checks if thisTypeDescriptionSourcecontains 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
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
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
Gets the first type item, if any- Returns:
- The first
TypeItemif any.nullotherwise
-
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
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
Gets the current set of type items- Returns:
- The type items of this source. May not be
null
-
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 givenTypeDescriptioninto 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
Merges the givenTypeDescriptionSourceinto 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
Sets the providedNumberQualifiersto the source.- Parameters:
stringQualifiers-NumberQualifiersobject. May benull
-
setStringQualifiers
Sets the providedStringQualifiersto the source.- Parameters:
stringQualifiers-StringQualifiersobject. May benull
-