Class DynamicFeatureAccessComputer

java.lang.Object
com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer

public class DynamicFeatureAccessComputer extends Object
Special computer for BSL grammar element DynamicFeatureAccess.
Computes types and parts for DynamicFeatureAccess
  • 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 object
      dynamicComputer - actual DynamicFeatureAccessComputer
      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 object
      dynamicComputer - actual DynamicFeatureAccessComputer
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property 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 resolve DynamicFeatureAccess as Event
      Parameters:
      feature - DynamicFeatureAccess for resolving
      computer - actual TypesComputer
      Returns:
      Event if it was resolved or null
    • isServerCall

      public static boolean isServerCall(Method method)
      Checks that server method can be called on client code
      Parameters:
      method - checking method, cannot be null
      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 in DynamicFeatureAccess
      Parameters:
      neighbourTypes - types of left neighbors
      envs - current environments, cannot be null
      name - name of object
      numParam - matters for method objects @see Method (for properties value should be -1)
      res - for resolving proxy, cannot be null
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      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 in DynamicFeatureAccess
      Parameters:
      neighbourTypes - types of left neighbors
      envs - current environments, cannot be null
      name - name of object
      numParam - matters for method objects @see Method (for properties value should be -1)
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module
      res - for resolving proxy, cannot be null
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      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 in DynamicFeatureAccess
      Parameters:
      neighbourTypes - types of left neighbors
      envs - current environments, cannot be null
      name - name of object, cannot be null
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module
      res - for resolving proxy, cannot be null
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      Returns:
      corresponding list of FeatureEntry or empty list
    • dividedIntoParts

      public List<org.eclipse.emf.ecore.EObject> dividedIntoParts(DynamicFeatureAccess featureAccess)
      Divides into parts DynamicFeatureAccess
      Parameters:
      featureAccess - grammar element
      Returns:
      list of parts EObject from right to left, never null
    • getTypes

      public List<TypeItem> getTypes(DynamicFeatureAccess featureAccess, Environments envs)
      Gets type of last expression in DynamicFeatureAccess
      Parameters:
      featureAccess - grammar element
      envs - corresponding Environments
      Returns:
      list of TypeItem, never null
    • 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 all TypeItem
      Parameters:
      list - of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 all TypeItem
      Parameters:
      list - of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 all TypeItem without methods from reference contextDef of type
      Parameters:
      types - list of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 of TypeItem
      Parameters:
      types - list of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 of TypeItem
      Parameters:
      types - list of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 of TypeItem
      Parameters:
      types - list of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 all TypeItem
      Parameters:
      types - list of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      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 of TypeItem
      Parameters:
      list - of types, cannot be null
      res - actual resource for resolving objects, cannot be null
      Returns:
      list of properties with corresponding type, never null
    • resolveObject

      public List<FeatureEntry> resolveObject(FeatureAccess featureAccess, Environments envs)
      Gets object from FeatureAccess and resolves it
      Parameters:
      featureAccess - current FeatureAccess, cannot be null
      envs - current Environments, cannot be null
      Returns:
      list of resolve FeatureEntry or empty list, never null
    • resolveObject

      public List<FeatureEntry> resolveObject(FeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
      Gets object from FeatureAccess and resolves it
      Parameters:
      featureAccess - current FeatureAccess, cannot be null
      envs - current Environments, cannot be null
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property 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, never null
    • getLastObject

      public List<FeatureEntry> getLastObject(DynamicFeatureAccess featureAccess, Environments envs)
      Gets last object in DynamicFeatureAccess and resolves it
      Parameters:
      featureAccess - current DynamicFeatureAccess, cannot be null
      envs - current Environments, cannot be null
      Returns:
      list of resolve FeatureEntry or empty list, never null
    • getLastObject

      public List<FeatureEntry> getLastObject(DynamicFeatureAccess featureAccess, Environments envs, boolean mockItemsAllowed)
      Gets last object in DynamicFeatureAccess and resolves it
      Parameters:
      featureAccess - current DynamicFeatureAccess, cannot be null
      envs - current Environments, cannot be null
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property 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, never null
    • getLastObject

      public List<FeatureEntry> getLastObject(IndexAccess indexAccess, Environments envs, boolean mockItemsAllowed)
      Gets last object in IndexAccess and resolves it
      Parameters:
      indexAccess - current IndexAccess, cannot be null
      envs - current Environments, cannot be null
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property 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, never null
    • 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 of DynamicFeatureAccess by index
      Parameters:
      parts - all parts of DynamicFeatureAccess
      index - number of part (left to right)
      envs - corresponding Environments
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      Returns:
      resolve list of FeatureEntry, never null
    • 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 of DynamicFeatureAccess by index
      Parameters:
      parts - all parts of DynamicFeatureAccess
      index - number of part (left to right)
      envs - corresponding Environments
      mockItemsAllowed - true if allowed for FeatureEntry.getFeature() return mock of exported user methods and properties. Mock exported user methods is special Method 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 special Property without resource and container, which contains right name of the export property, right properties: environments source uri to the real property in module
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      Returns:
      resolve list of FeatureEntry, never null
    • 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 of DynamicFeatureAccess by index
      Parameters:
      parts - all parts of DynamicFeatureAccess
      index - number of part (left to right)
      envs - corresponding Environments
      cancelIndicator - cancel indicator that allows early interruption of the computation. May not be null
      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 for feature
      Parameters:
      feature - must be DynamicFeatureAccess, if it's not true null will be returned
      numParam - matters for method objects @see Method
      computer - TypesComputer
      envs - actual Environments
      res - actual Resource
      Returns:
      found TypeItem or null
    • getTypeOfPreviousElementForProperty

      public TypeItem getTypeOfPreviousElementForProperty(FeatureAccess feature, TypesComputer computer, Environmental envs, org.eclipse.emf.ecore.resource.Resource res)
      Gets corresponding type of previous element for feature
      Parameters:
      feature - must be DynamicFeatureAccess, if it's not true null will be returned
      computer - TypesComputer, cannot be null
      envs - actual Environments, cannot be null
      res - actual Resource, cannot be null
      Returns:
      found TypeItem or null
    • 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 in DynamicFeatureAccess
      Parameters:
      neighbourTypes - types of left neighbors
      envs - actual Environments, cannot be null
      name - name of object, cannot be null
      numParam - matters for method objects @see Method
      res - actual resource for resolving objects, cannot be null
      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 in DynamicFeatureAccess
      Parameters:
      neighbourTypes - types of left neighbors
      envs - actual Environments, cannot be null
      name - name of object, cannot be null
      res - actual resource for resolving objects, cannot be null
      Returns:
      corresponding TypeItem, can be null
    • clearCachedValues

      public void clearCachedValues()
      Deleting all cached values