Class QueryBasedFeatureHelper
- java.lang.Object
-
- org.eclipse.viatra.addon.querybasedfeatures.runtime.QueryBasedFeatureHelper
-
public final class QueryBasedFeatureHelper extends java.lang.ObjectUtility class for instantiating query-based feature handlers (IQueryBasedFeatureHandler).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static QueryBasedFeaturecreateQueryBasedFeature(org.eclipse.emf.ecore.EStructuralFeature feature, QueryBasedFeatureKind kind, boolean keepCache)static IQueryBasedFeatureHandlergetQueryBasedFeatureHandler(org.eclipse.emf.common.notify.Notifier notifier, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind, boolean keepCache)static IQueryBasedFeatureHandlergetQueryBasedFeatureHandler(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind)Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeatureon the topmostNotifierreachable from the source.static IQueryBasedFeatureHandlergetQueryBasedFeatureHandler(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind, boolean keepCache, boolean useSourceAsNotifier)Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeatureon the source or the topmostNotifierreachable from the source.static IQueryBasedFeatureHandlergetQueryBasedFeatureHandlerOnNotifier(org.eclipse.emf.common.notify.Notifier notifier, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind)static org.eclipse.emf.common.notify.NotifierprepareNotifierForSource(org.eclipse.emf.ecore.EObject source)Decide whatNotifierto use as the scope of theViatraQueryMatcherunderlying the createdIQueryBasedFeatureHandler.
-
-
-
Method Detail
-
prepareNotifierForSource
public static org.eclipse.emf.common.notify.Notifier prepareNotifierForSource(org.eclipse.emf.ecore.EObject source)
Decide whatNotifierto use as the scope of theViatraQueryMatcherunderlying the createdIQueryBasedFeatureHandler.Optimally, the
ResourceSetis reachable and most other matchers will use it as well.Otherwise, the
Resourceis used if the model is not inside a resource set.If none of the above are reachable, the container hierarchy is traversed for a top element.
Finally, the source itself is returned.
- Parameters:
source- the source object that initializes the handler- Returns:
- the topmost reachable Notifier from the source
-
getQueryBasedFeatureHandler
public static IQueryBasedFeatureHandler getQueryBasedFeatureHandler(org.eclipse.emf.common.notify.Notifier notifier, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind, boolean keepCache)
Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeaturein the givenNotifier. If the handler does not exist yet, it is also initialized, before being returned.The required matcher is initialized using the pattern fully qualified name passed as a parameter.
- Parameters:
notifier- the exact notifier to use for the handler initializationfeature- the feature that is managed by the handlerpatternFQN- the fully qualified name of the pattern used by the handlersourceParamName- the name of the parameter in the pattern that represents the source end of the featuretargetParamName- the name of the parameter in the pattern that represents the target end of the featurekind- theQueryBasedFeatureKindthat is used by the handlerkeepCache- specifies whether the handler uses an internal cache for feature values. Only possible with single and many reference kinds- Returns:
- the query-based feature handler that manages the feature values
-
createQueryBasedFeature
protected static QueryBasedFeature createQueryBasedFeature(org.eclipse.emf.ecore.EStructuralFeature feature, QueryBasedFeatureKind kind, boolean keepCache)
-
getQueryBasedFeatureHandlerOnNotifier
public static IQueryBasedFeatureHandler getQueryBasedFeatureHandlerOnNotifier(org.eclipse.emf.common.notify.Notifier notifier, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind)
Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeaturein the givenNotifier. If the handler does not exist yet, it is also initialized, before being returned.The required matcher is initialized using the pattern fully qualified name passed as a parameter.
Calls
getQueryBasedFeatureHandler(Notifier, EStructuralFeature, String, String, String, QueryBasedFeatureKind, boolean)with keepCache = true.- Parameters:
notifier- the exact notifier to use for the handler initializationfeature- the feature that is managed by the handlerpatternFQN- the fully qualified name of the pattern used by the handlersourceParamName- the name of the parameter in the pattern that represents the source end of the featuretargetParamName- the name of the parameter in the pattern that represents the target end of the featurekind- theQueryBasedFeatureKindthat is used by the handler- Returns:
- the query-based feature handler that manages the feature values
-
getQueryBasedFeatureHandler
public static IQueryBasedFeatureHandler getQueryBasedFeatureHandler(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind, boolean keepCache, boolean useSourceAsNotifier)
Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeatureon the source or the topmostNotifierreachable from the source. If the handler does not exist yet, it is also initialized, before being returned.The required matcher is initialized using the pattern fully qualified name passed as a parameter.
- Parameters:
source- the source object used for the handler initialization (used for determining the notifier for the underlying matcher)feature- the feature that is managed by the handlerpatternFQN- the fully qualified name of the pattern used by the handlersourceParamName- the name of the parameter in the pattern that represents the source end of the featuretargetParamName- the name of the parameter in the pattern that represents the target end of the featurekind- theQueryBasedFeatureKindthat is used by the handlerkeepCache- specifies whether the handler uses an internal cache for feature values. Only possible with single and many reference kindsuseSourceAsNotifier- if true, the source is used as the notifier for the matcher initialization- Returns:
- the query-based feature handler that manages the feature values
-
getQueryBasedFeatureHandler
public static IQueryBasedFeatureHandler getQueryBasedFeatureHandler(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String patternFQN, java.lang.String sourceParamName, java.lang.String targetParamName, QueryBasedFeatureKind kind)
Returns theIQueryBasedFeatureHandlerfor the givenEStructuralFeatureon the topmostNotifierreachable from the source. If the handler does not exist yet, it is also initialized, before being returned.The required matcher is initialized using the pattern fully qualified name passed as a parameter.
- Parameters:
source- the source object used for the handler initialization (used for determining the notifier for the underlying matcher)feature- the feature that is managed by the handlerpatternFQN- the fully qualified name of the pattern used by the handlersourceParamName- the name of the parameter in the pattern that represents the source end of the featuretargetParamName- the name of the parameter in the pattern that represents the target end of the featurekind- theQueryBasedFeatureKindthat is used by the handler- Returns:
- the query-based feature handler that manages the feature values
-
-