Package com._1c.g5.v8.dt.bsl.resource
Class DynamicFeatureAccessComputer
java.lang.Object
com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer
Special computer for BSL grammar element
Computes types and parts for
DynamicFeatureAccess. Computes types and parts for
DynamicFeatureAccess-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSpecial provider for getting conformity between dynamic types name for collections of metaobject and their property type name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeleting all cached valuesList<org.eclipse.emf.ecore.EObject>dividedIntoParts(DynamicFeatureAccess featureAccess) Divides into partsDynamicFeatureAccessCollection<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 allTypeItemCollection<org.eclipse.xtext.util.Pair<Collection<Method>,TypeItem>> getAllMethods(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res) Gets all methods from allTypeItemCollection<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 ofTypeItemCollection<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 allTypeItemwithout 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 ofTypeItemCollection<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 ofTypeItemCollection<org.eclipse.xtext.util.Pair<Collection<Property>,TypeItem>> getAllProperties(Collection<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res) Gets all properties from allTypeItemCollection<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 ofTypeItemgetCorrespondingType(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 inDynamicFeatureAccessgetCorrespondingType(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 inDynamicFeatureAccessgetLastObject(DynamicFeatureAccess featureAccess, Environments envs) Gets last object inDynamicFeatureAccessand resolves itgetLastObject(DynamicFeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed) Gets last object inDynamicFeatureAccessand resolves itgetLastObject(IndexAccess indexAccess, Environments envs, boolean mockItemsAllowed) Gets last object inIndexAccessand resolves itgetObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, boolean mockItemsAllowed, org.eclipse.xtext.util.CancelIndicator cancelIndicator) Gets resolve part ofDynamicFeatureAccessby indexgetObjectForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator) Gets resolve part ofDynamicFeatureAccessby indexgetObjectFromContextDefOfTypes(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 inDynamicFeatureAccessgetObjectFromContextDefOfTypes(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 inDynamicFeatureAccessgetObjectFromContextDefOfTypes(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 inDynamicFeatureAccessgetTypeOfPreviousElementForMethod(FeatureAccess feature, int numParam, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res) Gets corresponding type of previous element forfeaturegetTypeOfPreviousElementForProperty(FeatureAccess feature, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res) Gets corresponding type of previous element forfeaturegetTypes(DynamicFeatureAccess featureAccess, Environments envs) Gets type of last expression inDynamicFeatureAccessgetTypesForPartByIndex(List<org.eclipse.emf.ecore.EObject> parts, int index, Environments envs, org.eclipse.xtext.util.CancelIndicator cancelIndicator) Gets types for part ofDynamicFeatureAccessby indexstatic booleanisServerCall(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 EventresolveEvent(DynamicFeatureAccess feature, TypesComputer computer) Try to resolveDynamicFeatureAccessasEventresolveObject(FeatureAccess featureAccess, Environments envs) Gets object fromFeatureAccessand resolves itresolveObject(FeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed) Gets object fromFeatureAccessand resolves it
-
Constructor Details
-
DynamicFeatureAccessComputer
public DynamicFeatureAccessComputer()Initialize dynamic type description
-
-
Method Details
-
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- actualDynamicFeatureAccessComputermockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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
Try to resolveDynamicFeatureAccessasEvent- Parameters:
feature-DynamicFeatureAccessfor resolvingcomputer- actualTypesComputer- Returns:
Eventif it was resolved ornull
-
isServerCall
Checks that server method can be called on client code- Parameters:
method- checking method, cannot benull- Returns:
trueif that sever call,falseotherwise
-
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 benullname- name of objectnumParam- matters for method objects @see Method (for properties value should be -1)res- for resolving proxy, cannot benullcancelIndicator- cancel indicator that allows early interruption of the computation. May not benull- Returns:
- corresponding list of
FeatureEntryor 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 benullname- name of objectnumParam- matters for method objects @see Method (for properties value should be -1)mockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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 benullcancelIndicator- cancel indicator that allows early interruption of the computation. May not benull- Returns:
- corresponding list of
FeatureEntryor 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 benullname- name of object, cannot benullmockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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 benullcancelIndicator- cancel indicator that allows early interruption of the computation. May not benull- Returns:
- corresponding list of
FeatureEntryor empty list
-
dividedIntoParts
Divides into partsDynamicFeatureAccess- Parameters:
featureAccess- grammar element- Returns:
- list of parts
EObjectfrom right to left, nevernull
-
getTypes
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>, getAllMethodAndPropertiesTypeItem>> (List<TypeItem> types, org.eclipse.emf.ecore.resource.Resource res) Gets all properties and methods from allTypeItem- Parameters:
list- of types, cannot benullres- 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 benullres- 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 allTypeItemwithout methods from reference contextDef of type- Parameters:
types- list of types, cannot benullres- 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 benullres- 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 benullres- 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 benullres- 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 benullres- 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 benullres- actual resource for resolving objects, cannot benull- Returns:
- list of properties with corresponding type, never
null
-
resolveObject
Gets object fromFeatureAccessand resolves it- Parameters:
featureAccess- currentFeatureAccess, cannot benullenvs- currentEnvironments, cannot benull- Returns:
- list of resolve
FeatureEntryor empty list, nevernull
-
resolveObject
public List<FeatureEntry> resolveObject(FeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed) Gets object fromFeatureAccessand resolves it- Parameters:
featureAccess- currentFeatureAccess, cannot benullenvs- currentEnvironments, cannot benullmockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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
FeatureEntryor empty list, nevernull
-
getLastObject
Gets last object inDynamicFeatureAccessand resolves it- Parameters:
featureAccess- currentDynamicFeatureAccess, cannot benullenvs- currentEnvironments, cannot benull- Returns:
- list of resolve
FeatureEntryor empty list, nevernull
-
getLastObject
public List<FeatureEntry> getLastObject(DynamicFeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed) Gets last object inDynamicFeatureAccessand resolves it- Parameters:
featureAccess- currentDynamicFeatureAccess, cannot benullenvs- currentEnvironments, cannot benullmockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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
FeatureEntryor empty list, nevernull
-
getLastObject
public List<FeatureEntry> getLastObject(IndexAccess indexAccess, Environments envs, boolean mockItemsAllowed) Gets last object inIndexAccessand resolves it- Parameters:
indexAccess- currentIndexAccess, cannot benullenvs- currentEnvironments, cannot benullmockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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
FeatureEntryor 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 ofDynamicFeatureAccessby index- Parameters:
parts- all parts ofDynamicFeatureAccessindex- number of part (left to right)envs- correspondingEnvironmentscancelIndicator- 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 ofDynamicFeatureAccessby index- Parameters:
parts- all parts ofDynamicFeatureAccessindex- number of part (left to right)envs- correspondingEnvironmentsmockItemsAllowed-trueif allowed forFeatureEntry.getFeature()return mock of exported user methods and properties. Mock exported user methods is specialMethodwithout 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 specialPropertywithout 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 ofDynamicFeatureAccessby index- Parameters:
parts- all parts ofDynamicFeatureAccessindex- number of part (left to right)envs- correspondingEnvironmentscancelIndicator- 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 truenullwill be returnednumParam- matters for method objects @see Methodcomputer-TypesComputerenvs- actualEnvironmentsres- actualResource- Returns:
- found
TypeItemornull
-
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 truenullwill be returnedcomputer-TypesComputer, cannot benullenvs- actualEnvironments, cannot benullres- actualResource, cannot benull- Returns:
- found
TypeItemornull
-
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 benullname- name of object, cannot benullnumParam- 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 benullname- name of object, cannot benullres- actual resource for resolving objects, cannot benull- Returns:
- corresponding
TypeItem, can benull
-
clearCachedValues
public void clearCachedValues()Deleting all cached values
-