Package com._1c.g5.v8.dt.bsl.model.util
Class BslUtil
java.lang.Object
com._1c.g5.v8.dt.bsl.model.util.BslUtil
Useful utility methods to work with Bsl model.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<DeclareStatement>Gets allDeclareStatementfromPreprocessorItemstatic <T extends org.eclipse.emf.ecore.EObject>
List<T>allDeclareStatements(org.eclipse.emf.ecore.EObject block) Gets allDeclareStatementfromBlockstatic Collection<Method>allMethods(PreprocessorItem item) Gets allMethodfromPreprocessorItemstatic <T extends org.eclipse.emf.ecore.EObject>
List<T>allMethods(org.eclipse.emf.ecore.EObject module) static Collection<Statement>Gets allStatementfromPreprocessorItemstatic <T extends org.eclipse.emf.ecore.EObject>
List<T>allStatements(org.eclipse.emf.ecore.EObject block) static booleancanBeEventHandlerByParamCounts(Method method, ParamSet paramSet, int additionalIndex) Check Built-In language method that it can be event handler in form by parametersstatic List<IfPreprocessor>getAllIfPreprocessors(org.eclipse.emf.ecore.EObject module) Gets allIfPreprocessorfromModulestatic List<IfPreprocessor>getAllIfPreprocessorsFromBlock(org.eclipse.emf.ecore.EObject block) Gets allIfPreprocessorfromBlockstatic List<LabeledStatement>getAllLabeledStatements(Block block) Retrieves all instances ofLabeledStatementcontained in theblock.static <T extends org.eclipse.emf.ecore.EObject>
List<T>getAllPreprocessorItems(org.eclipse.emf.ecore.EObject preprocessor) Gets allPreprocessorItemformPreprocessorstatic List<RegionPreprocessor>getAllRegionPreprocessors(org.eclipse.emf.ecore.EObject module) Gets allRegionPreprocessorfromModulestatic List<RegionPreprocessor>getAllRegionPreprocessorsFromBlock(org.eclipse.emf.ecore.EObject block) Gets allIfPreprocessorfromBlockgetEffectivePragmas(PragmaTarget pragmaTarget) Returns effective pragmas forPragmaTargetinstance.
Effective pragmas are computed by following algorithm:
- if many-valued referencepragmasofPragmaTargetinstance contains at least one item, value of this reference is returned
- otherwise function attempts to findModulecontainingPragmaTarget.static InvocationDetermeines whether passed in the parameterFeatureAccessis invocation target.static InvocationgetInvocation(FeatureEntry entry) Determeines whether passed in the parameterFeatureEntryis invocation target.static intgetMaxCountOfParameters(Method method) Get maximum number of parameters of bsl methodstatic intgetMinCountOfParameters(Method method) Get minimum number of parameters of bsl methodstatic StringgetPragmaValue(Pragma pragma) Gets content of the feature "value" ofPragmaby its original content without service symbols ('"')getStringLiteralContent(StringLiteral literal, boolean trim) Gets content of the StringLiteral by its lines without service symbols ('"', '|')static booleanhasEffectivePragma(PragmaTarget pragmaTarget, String... symbols) Function determines if effective pragmas ofPragmaTargetinstance contains at least onePragmawithsymbolequal (ignoring case) to one ofsymbols.static booleanhasPragma(PragmaTarget pragmaTarget, String... symbols) Function determines ifPragmaTargetinstance contains at least onePragmawithsymbolequal (ignoring case) to at least one ofsymbols.static booleanChecks thatfeatruecorresponding to the feature of global property 'Metadata' with name 'ObjectProperties'static booleanChecks availability ofEventfor mobile applicationstatic booleanisEmptyPreprocessorItem(org.eclipse.emf.ecore.EObject item) ChecksPreprocessorItemfor emptystatic booleanisEventHandler(FeatureEntry entry) Determines whether passedFeatureEntryrepresents referense to the event handler method.static booleanDetermines whether passedStaticFeatureAccessrepresents referense to the event handler method.static booleanDetermines whether passedInvocationis procedure invocation or not.static booleanDetermines whether passed in the parameter instance ofStaticFeatureAccessis target of assignment.static booleanChecks access to system enum property
-
Constructor Details
-
BslUtil
public BslUtil()
-
-
Method Details
-
getAllLabeledStatements
Retrieves all instances ofLabeledStatementcontained in theblock.- Parameters:
block- block. May not benull.- Returns:
- list of
LabeledStatementinstances.
-
getInvocation
Determeines whether passed in the parameterFeatureAccessis invocation target. If so returnsInvocationinstance. Otherwise returnsnull.- Parameters:
instance- ofFeatureAccess. May not benull.- Returns:
- instance of
Invocationornullif passedFeatureAccessisn't invocation target.
-
getInvocation
Determeines whether passed in the parameterFeatureEntryis invocation target. If so returnsInvocationinstance. Otherwise returnsnull.- Parameters:
instance- ofFeatureEntry. May not benull.- Returns:
- instance of
Invocationornullif passedFeatureEntryisn't invocation target.
-
isProcedureInvocation
Determines whether passedInvocationis procedure invocation or not. Procedure invocation is invocation not requiring return value.- Parameters:
inv- instance ofInvocation. May not benull.- Returns:
trueif passedInvocationis procedure invocation. Otherwisefalse.
-
isEventHandler
Determines whether passedStaticFeatureAccessrepresents referense to the event handler method.- Parameters:
acc- instance ofStaticFeatureAccess. May not benull.- Returns:
trueif passedStaticFeatureAccessrefers to the eventHandlermethod. Otherwisefalse.
-
isEventHandler
Determines whether passedFeatureEntryrepresents referense to the event handler method.- Parameters:
acc- instance ofFeatureEntry. May not benull.- Returns:
trueif passedFeatureEntryrefers to the eventHandlermethod. Otherwisefalse.
-
isTargetOfAssignment
Determines whether passed in the parameter instance ofStaticFeatureAccessis target of assignment.- Parameters:
acc- instance ofStaticFeatureAccess. May benull.- Returns:
trueif passedStaticFeatureAccessis target of assignment. Otherwisefalse.
-
getEffectivePragmas
Returns effective pragmas forPragmaTargetinstance.
Effective pragmas are computed by following algorithm:
- if many-valued referencepragmasofPragmaTargetinstance contains at least one item, value of this reference is returned
- otherwise function attempts to findModulecontainingPragmaTarget. IfModulefound, value of it'sdefaultPragmasreference is returned
- otherwise function returns empty list- Parameters:
pragmaTarget-PragmaTargetinstnace. Can't benull.- Returns:
- list of effective pragmas. Client sholdn't modify this list.
-
hasPragma
Function determines ifPragmaTargetinstance contains at least onePragmawithsymbolequal (ignoring case) to at least one ofsymbols.- Parameters:
pragmaTarget-PragmaTargetinstance. Can't benull.symbols- array of symbols. Can't benull- Returns:
trueifPragmaTargetcontains at leastPragmawithsymbolequal to at least one ofsymbols.
-
hasEffectivePragma
Function determines if effective pragmas ofPragmaTargetinstance contains at least onePragmawithsymbolequal (ignoring case) to one ofsymbols.- Parameters:
pragmaTarget-PragmaTargetinstance. Can't benull.symbols- array of symbols. Can't benull- Returns:
trueif effective pragmas ofPragmaTargetcontains at least onePragmawithsymbolequal to at least one ofsymbols.
-
isEmptyPreprocessorItem
public static boolean isEmptyPreprocessorItem(org.eclipse.emf.ecore.EObject item) ChecksPreprocessorItemfor empty- Parameters:
item-- Returns:
true, ifPreprocessorItemnull, empty or has empty element
-
allMethods
public static <T extends org.eclipse.emf.ecore.EObject> List<T> allMethods(org.eclipse.emf.ecore.EObject module) -
allDeclareStatements
public static <T extends org.eclipse.emf.ecore.EObject> List<T> allDeclareStatements(org.eclipse.emf.ecore.EObject block) Gets allDeclareStatementfromBlock- Parameters:
module- processBlock. Can't benull- Returns:
- list of
DeclareStatement
-
allStatements
public static <T extends org.eclipse.emf.ecore.EObject> List<T> allStatements(org.eclipse.emf.ecore.EObject block) -
getAllPreprocessorItems
public static <T extends org.eclipse.emf.ecore.EObject> List<T> getAllPreprocessorItems(org.eclipse.emf.ecore.EObject preprocessor) Gets allPreprocessorItemformPreprocessor- Parameters:
preprocessor- processingPreprocessor. Can't benull- Returns:
- list of all
PreprocessorItem
-
getAllIfPreprocessors
Gets allIfPreprocessorfromModule- Parameters:
module- Bsl module. Can't benull- Returns:
- list of
IfPreprocessor
-
getAllIfPreprocessorsFromBlock
public static List<IfPreprocessor> getAllIfPreprocessorsFromBlock(org.eclipse.emf.ecore.EObject block) Gets allIfPreprocessorfromBlock- Parameters:
block- block in Bsl module. Can't benull- Returns:
- list of
IfPreprocessor
-
getAllRegionPreprocessors
public static List<RegionPreprocessor> getAllRegionPreprocessors(org.eclipse.emf.ecore.EObject module) Gets allRegionPreprocessorfromModule- Parameters:
module- Bsl module. Can't benull- Returns:
- list of
RegionPreprocessor
-
getAllRegionPreprocessorsFromBlock
public static List<RegionPreprocessor> getAllRegionPreprocessorsFromBlock(org.eclipse.emf.ecore.EObject block) Gets allIfPreprocessorfromBlock- Parameters:
block- block in Bsl module. Can't benull- Returns:
- list of
IfPreprocessor
-
allMethods
Gets allMethodfromPreprocessorItem- Parameters:
item-PreprocessorItem- Returns:
- list of
MethodfromPreprocessorItem
-
allStatements
Gets allStatementfromPreprocessorItem- Parameters:
item-PreprocessorItem- Returns:
- list of
StatementfromPreprocessorItem
-
allDeclareStatements
Gets allDeclareStatementfromPreprocessorItem- Parameters:
item-PreprocessorItem- Returns:
- list of
DeclareStatementfromPreprocessorItem
-
getMinCountOfParameters
Get minimum number of parameters of bsl method- Parameters:
method- actual bsl method, can't benull- Returns:
- minimum number of parameters of bsl method
-
getMaxCountOfParameters
Get maximum number of parameters of bsl method- Parameters:
method- actual bsl method, can't benull- Returns:
- maximum number of parameters of bsl method
-
canBeEventHandlerByParamCounts
public static boolean canBeEventHandlerByParamCounts(Method method, ParamSet paramSet, int additionalIndex) Check Built-In language method that it can be event handler in form by parameters -
isAllowedForMobileApplication
Checks availability ofEventfor mobile application- Parameters:
event- checking event, can't benull- Returns:
trueifEventavailable for mobile application,falseotherwise
-
isValidAccessToSysEnumProperty
Checks access to system enum property- Parameters:
feature-DynamicFeatureAccesswhichDynamicFeatureAccess.getSource()corresponding to the system enum type, can't benull- Returns:
trueif access to system enum value get through system enum global property,falseotherwise
-
isAccessToObjectPropertiesOfMetadata
Checks thatfeatruecorresponding to the feature of global property 'Metadata' with name 'ObjectProperties'- Parameters:
feature- checkingDynamicFeatureAccess, can't benull- Returns:
trueiffeatruecorresponding to the feature of global property 'Metadata' with name 'ObjectProperties',falseotherwise
-
getStringLiteralContent
Gets content of the StringLiteral by its lines without service symbols ('"', '|')- Parameters:
literal- processingStringLiteral, can't benulltrim- defines needing to removing leading and trailing whitespace- Returns:
- list of string line without service symbols, never
null
-
getPragmaValue
Gets content of the feature "value" ofPragmaby its original content without service symbols ('"')
-