Package com._1c.g5.v8.dt.bsl.resource
Class DynamicFeatureAccessComputer
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer
-
public class DynamicFeatureAccessComputer extends Object
Special computer for BSL grammar elementDynamicFeatureAccess
.
Computes types and parts forDynamicFeatureAccess
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DynamicFeatureAccessComputer.DynamicPropertyTypeNameMapper
Special provider for getting conformity between dynamic types name for collections of metaobject and their property type name
-
Constructor Summary
Constructors Constructor Description DynamicFeatureAccessComputer()
Initialize dynamic type description
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCachedValues()
Deleting all cached valuesList<org.eclipse.emf.ecore.EObject>
dividedIntoParts(DynamicFeatureAccess featureAccess)
Divides into partsDynamicFeatureAccess
Collection<org.eclipse.xtext.util.Triple<Collection<Method>,Collection<Property>,TypeItem>>
getAllMethodAndProperties(List<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all properties and methods from allTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<Method>,TypeItem>>
getAllMethods(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all methods from allTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>>
getAllMethodsFromRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets only methods from all reference contextDef ofTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>>
getAllMethodsWithoutRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all methods from allTypeItem
without methods from reference contextDef of typeCollection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>>
getAllMockMethodsFromRefContextDef(Collection<TypeItem> types, String methodName, org.eclipse.emf.ecore.resource.Resource res)
Gets only methods from all reference contextDef ofTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>>
getAllMockPropertiesFromRefContextDef(Collection<TypeItem> types, String propertyName, org.eclipse.emf.ecore.resource.Resource res)
Gets only properties from all reference contextDef ofTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>>
getAllProperties(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all properties from allTypeItem
Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>>
getAllPropertiesFromRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets only properties from all reference contextDef ofTypeItem
TypeItem
getCorrespondingType(Collection<TypeItem> neighbourTypes, Environments envs, String name, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type by name from properties, if we know parent types inDynamicFeatureAccess
TypeItem
getCorrespondingType(List<TypeItem> neighbourTypes, Environments envs, String name, int numParam, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type by name from methods, if we know parent types inDynamicFeatureAccess
List<FeatureEntry>
getLastObject(DynamicFeatureAccess featureAccess, Environments envs)
Gets last object inDynamicFeatureAccess
and resolves itList<FeatureEntry>
getLastObject(DynamicFeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
Gets last object inDynamicFeatureAccess
and resolves itList<FeatureEntry>
getLastObject(IndexAccess indexAccess, Environments envs, boolean mockItemsAllowed)
Gets last object inIndexAccess
and resolves itList<FeatureEntry>
getObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, boolean mockItemsAllowed, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets resolve part ofDynamicFeatureAccess
by indexList<FeatureEntry>
getObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets resolve part ofDynamicFeatureAccess
by indexList<FeatureEntry>
getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, boolean mockItemsAllowed, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
List<FeatureEntry>
getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, int numParam, boolean mockItemsAllowed, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
List<FeatureEntry>
getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, int numParam, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
TypeItem
getTypeOfPreviousElementForMethod(FeatureAccess feature, int numParam, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type of previous element forfeature
TypeItem
getTypeOfPreviousElementForProperty(FeatureAccess feature, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type of previous element forfeature
List<TypeItem>
getTypes(DynamicFeatureAccess featureAccess, Environments envs)
Gets type of last expression inDynamicFeatureAccess
List<TypeItem>
getTypesForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets types for part ofDynamicFeatureAccess
by indexstatic boolean
isServerCall(Method method)
Checks that server method can be called on client codestatic List<FeatureEntry>
resolveDynamicFeatureAccess(org.eclipse.emf.ecore.EObject object, DynamicFeatureAccessComputer dynamicComputer)
Gets actual model object by grammar objectstatic List<FeatureEntry>
resolveDynamicFeatureAccess(org.eclipse.emf.ecore.EObject object, DynamicFeatureAccessComputer dynamicComputer, boolean mockItemsAllowed)
Gets actual model object by grammar objectstatic Event
resolveEvent(DynamicFeatureAccess feature, TypesComputer computer)
Try to resolveDynamicFeatureAccess
asEvent
List<FeatureEntry>
resolveObject(FeatureAccess featureAccess, Environments envs)
Gets object fromFeatureAccess
and resolves itList<FeatureEntry>
resolveObject(FeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
Gets object fromFeatureAccess
and resolves it
-
-
-
Method Detail
-
resolveDynamicFeatureAccess
public static List<FeatureEntry> resolveDynamicFeatureAccess(org.eclipse.emf.ecore.EObject object, DynamicFeatureAccessComputer dynamicComputer)
Gets actual model object by grammar object- Parameters:
object
- BSL grammar objectdynamicComputer
- actualDynamicFeatureAccessComputer
- Returns:
- list of model object in
FeatureEntry
(Type
,Method
,Property
)
-
resolveDynamicFeatureAccess
public static List<FeatureEntry> resolveDynamicFeatureAccess(org.eclipse.emf.ecore.EObject object, DynamicFeatureAccessComputer dynamicComputer, boolean mockItemsAllowed)
Gets actual model object by grammar object- Parameters:
object
- BSL grammar objectdynamicComputer
- actualDynamicFeatureAccessComputer
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module- Returns:
- list of model object in
FeatureEntry
(Type
,Method
,Property
)
-
resolveEvent
public static Event resolveEvent(DynamicFeatureAccess feature, TypesComputer computer)
Try to resolveDynamicFeatureAccess
asEvent
- Parameters:
feature
-DynamicFeatureAccess
for resolvingcomputer
- actualTypesComputer
- Returns:
Event
if it was resolved ornull
-
isServerCall
public static boolean isServerCall(Method method)
Checks that server method can be called on client code- Parameters:
method
- checking method, cannot benull
- Returns:
true
if that sever call,false
otherwise
-
getObjectFromContextDefOfTypes
public List<FeatureEntry> getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, int numParam, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
- Parameters:
neighbourTypes
- types of left neighborsenvs
- current environments, cannot benull
name
- name of objectnumParam
- matters for method objects @see Method (for properties value should be -1)res
- for resolving proxy, cannot benull
cancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- corresponding list of
FeatureEntry
or empty list
-
getObjectFromContextDefOfTypes
public List<FeatureEntry> getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, int numParam, boolean mockItemsAllowed, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
- Parameters:
neighbourTypes
- types of left neighborsenvs
- current environments, cannot benull
name
- name of objectnumParam
- matters for method objects @see Method (for properties value should be -1)mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in moduleres
- for resolving proxy, cannot benull
cancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- corresponding list of
FeatureEntry
or empty list
-
getObjectFromContextDefOfTypes
public List<FeatureEntry> getObjectFromContextDefOfTypes(Collection<TypeItem> neighbourTypes, Environments envs, String name, boolean mockItemsAllowed, org.eclipse.emf.ecore.resource.Resource res, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets corresponding by name, if we know parent types inDynamicFeatureAccess
- Parameters:
neighbourTypes
- types of left neighborsenvs
- current environments, cannot benull
name
- name of object, cannot benull
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in moduleres
- for resolving proxy, cannot benull
cancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- corresponding list of
FeatureEntry
or empty list
-
dividedIntoParts
public List<org.eclipse.emf.ecore.EObject> dividedIntoParts(DynamicFeatureAccess featureAccess)
Divides into partsDynamicFeatureAccess
- Parameters:
featureAccess
- grammar element- Returns:
- list of parts
EObject
from right to left, nevernull
-
getTypes
public List<TypeItem> getTypes(DynamicFeatureAccess featureAccess, Environments envs)
Gets type of last expression inDynamicFeatureAccess
- Parameters:
featureAccess
- grammar elementenvs
- correspondingEnvironments
- Returns:
- list of
TypeItem
, nevernull
-
getAllMethodAndProperties
public Collection<org.eclipse.xtext.util.Triple<Collection<Method>,Collection<Property>,TypeItem>> getAllMethodAndProperties(List<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all properties and methods from allTypeItem
- Parameters:
list
- of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of properties and methods with corresponding type, never
null
-
getAllMethods
public Collection<org.eclipse.xtext.util.Pair<Collection<Method>,TypeItem>> getAllMethods(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all methods from allTypeItem
- Parameters:
list
- of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of methods with corresponding type, never
null
-
getAllMethodsWithoutRefContextDef
public Collection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>> getAllMethodsWithoutRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all methods from allTypeItem
without methods from reference contextDef of type- Parameters:
types
- list of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of methods with corresponding type, never
null
-
getAllMethodsFromRefContextDef
public Collection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>> getAllMethodsFromRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets only methods from all reference contextDef ofTypeItem
- Parameters:
types
- list of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of methods with corresponding type, never
null
-
getAllMockMethodsFromRefContextDef
public Collection<org.eclipse.xtext.util.Pair<Collection<com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer.IMethodProvider>,TypeItem>> getAllMockMethodsFromRefContextDef(Collection<TypeItem> types, String methodName, org.eclipse.emf.ecore.resource.Resource res)
Gets only methods from all reference contextDef ofTypeItem
- Parameters:
types
- list of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of methods with corresponding type, never
null
-
getAllMockPropertiesFromRefContextDef
public Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>> getAllMockPropertiesFromRefContextDef(Collection<TypeItem> types, String propertyName, org.eclipse.emf.ecore.resource.Resource res)
Gets only properties from all reference contextDef ofTypeItem
- Parameters:
types
- list of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of properties with corresponding type, never
null
-
getAllProperties
public Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>> getAllProperties(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets all properties from allTypeItem
- Parameters:
types
- list of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of properties with corresponding type, never
null
-
getAllPropertiesFromRefContextDef
public Collection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>> getAllPropertiesFromRefContextDef(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res)
Gets only properties from all reference contextDef ofTypeItem
- Parameters:
list
- of types, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- list of properties with corresponding type, never
null
-
resolveObject
public List<FeatureEntry> resolveObject(FeatureAccess featureAccess, Environments envs)
Gets object fromFeatureAccess
and resolves it- Parameters:
featureAccess
- currentFeatureAccess
, cannot benull
envs
- currentEnvironments
, cannot benull
- Returns:
- list of resolve
FeatureEntry
or empty list, nevernull
-
resolveObject
public List<FeatureEntry> resolveObject(FeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
Gets object fromFeatureAccess
and resolves it- Parameters:
featureAccess
- currentFeatureAccess
, cannot benull
envs
- currentEnvironments
, cannot benull
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module- Returns:
- list of resolve
FeatureEntry
or empty list, nevernull
-
getLastObject
public List<FeatureEntry> getLastObject(DynamicFeatureAccess featureAccess, Environments envs)
Gets last object inDynamicFeatureAccess
and resolves it- Parameters:
featureAccess
- currentDynamicFeatureAccess
, cannot benull
envs
- currentEnvironments
, cannot benull
- Returns:
- list of resolve
FeatureEntry
or empty list, nevernull
-
getLastObject
public List<FeatureEntry> getLastObject(DynamicFeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
Gets last object inDynamicFeatureAccess
and resolves it- Parameters:
featureAccess
- currentDynamicFeatureAccess
, cannot benull
envs
- currentEnvironments
, cannot benull
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module- Returns:
- list of resolve
FeatureEntry
or empty list, nevernull
-
getLastObject
public List<FeatureEntry> getLastObject(IndexAccess indexAccess, Environments envs, boolean mockItemsAllowed)
Gets last object inIndexAccess
and resolves it- Parameters:
indexAccess
- currentIndexAccess
, cannot benull
envs
- currentEnvironments
, cannot benull
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module- Returns:
- list of resolve
FeatureEntry
or empty list, nevernull
-
getObjectForPartByIndex
public List<FeatureEntry> getObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets resolve part ofDynamicFeatureAccess
by index- Parameters:
parts
- all parts ofDynamicFeatureAccess
index
- number of part (left to right)envs
- correspondingEnvironments
cancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- resolve list of
FeatureEntry
, nevernull
-
getObjectForPartByIndex
public List<FeatureEntry> getObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, boolean mockItemsAllowed, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets resolve part ofDynamicFeatureAccess
by index- Parameters:
parts
- all parts ofDynamicFeatureAccess
index
- number of part (left to right)envs
- correspondingEnvironments
mockItemsAllowed
-true
if allowed forFeatureEntry.getFeature()
return mock of exported user methods and properties. Mock exported user methods is specialMethod
without resource and container, which contains right name of the export method, right properties: isRetval, isDeprecated, isServerCall, source uri to the real method in module, min parameters count and information about each parameter - out or not Mock exported user properties is specialProperty
without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in modulecancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- resolve list of
FeatureEntry
, nevernull
-
getTypesForPartByIndex
public List<TypeItem> getTypesForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator)
Gets types for part ofDynamicFeatureAccess
by index- Parameters:
parts
- all parts ofDynamicFeatureAccess
index
- number of part (left to right)envs
- correspondingEnvironments
cancelIndicator
- cancel indicator that allows early interruption of the computation. May not benull
- Returns:
- list of corresponding
TypeItem
-
getTypeOfPreviousElementForMethod
public TypeItem getTypeOfPreviousElementForMethod(FeatureAccess feature, int numParam, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type of previous element forfeature
- Parameters:
feature
- must beDynamicFeatureAccess
, if it's not truenull
will be returnednumParam
- matters for method objects @see Methodcomputer
-TypesComputer
envs
- actualEnvironments
res
- actualResource
- Returns:
- found
TypeItem
ornull
-
getTypeOfPreviousElementForProperty
public TypeItem getTypeOfPreviousElementForProperty(FeatureAccess feature, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type of previous element forfeature
- Parameters:
feature
- must beDynamicFeatureAccess
, if it's not truenull
will be returnedcomputer
-TypesComputer
, cannot benull
envs
- actualEnvironments
, cannot benull
res
- actualResource
, cannot benull
- Returns:
- found
TypeItem
ornull
-
getCorrespondingType
public TypeItem getCorrespondingType(List<TypeItem> neighbourTypes, Environments envs, String name, int numParam, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type by name from methods, if we know parent types inDynamicFeatureAccess
- Parameters:
neighbourTypes
- types of left neighborsenvs
- actualEnvironments
, cannot benull
name
- name of object, cannot benull
numParam
- matters for method objects @see Methodres
- actual resource for resolving objects, cannot benull
- Returns:
- corresponding list
TypeItem
-
getCorrespondingType
public TypeItem getCorrespondingType(Collection<TypeItem> neighbourTypes, Environments envs, String name, org.eclipse.emf.ecore.resource.Resource res)
Gets corresponding type by name from properties, if we know parent types inDynamicFeatureAccess
- Parameters:
neighbourTypes
- types of left neighborsenvs
- actualEnvironments
, cannot benull
name
- name of object, cannot benull
res
- actual resource for resolving objects, cannot benull
- Returns:
- corresponding
TypeItem
, can benull
-
clearCachedValues
public void clearCachedValues()
Deleting all cached values
-
-