org.eclipse.emf.facet.efacet.core
Interface IDerivedTypedElementManager


public interface IDerivedTypedElementManager

Used to evaluate derived typed elements through their queries.

Since:
0.2

Field Summary
static IDerivedTypedElementManager INSTANCE
           
 
Method Summary
<T extends ETypedElementResult>
java.util.List<T>
batchEvaluate(DerivedTypedElement derivedTE, java.util.Collection<? extends EObject> sources, java.util.List<ParameterValue> parameterValues, java.lang.Class<T> resultType, IFacetManager facetManager)
          Evaluates a derived typed element on a list of model elements in a single call.
 java.lang.Object evaluate(DerivedTypedElement derivedTE, EObject source, java.util.List<ParameterValue> parameterValues, IFacetManager facetManager)
          Evaluates a derived typed element on a model element.
 java.lang.Object evaluate(Query query, EObject source, java.util.List<ParameterValue> parameterValues, IFacetManager facetManager)
          Evaluates a query on a model element.
<T> java.util.List<T>
evaluateMultiValued(DerivedTypedElement derivedTE, EObject source, java.util.List<ParameterValue> parameterValues, java.lang.Class<T> resultType, IFacetManager facetManager)
          Evaluates a multi-valued derived typed element on a model element.
<T> T
evaluateSingleValued(DerivedTypedElement derivedTE, EObject source, java.util.List<ParameterValue> parameterValues, java.lang.Class<T> resultType, IFacetManager facetManager)
          Evaluates a single valued derived typed element on a model element.
 

Field Detail

INSTANCE

static final IDerivedTypedElementManager INSTANCE
Method Detail

evaluate

java.lang.Object evaluate(DerivedTypedElement derivedTE,
                          EObject source,
                          java.util.List<ParameterValue> parameterValues,
                          IFacetManager facetManager)
                          throws DerivedTypedElementException
Evaluates a derived typed element on a model element.

Note: this method does not return a typed result, and it does not check the result type. Use evaluateSingleValued or evaluateMultiValued instead if you want a typed and type-checked result.

Parameters:
derivedTE - the derived typed element to evaluate
source - the model element on which the derived typed element must be evaluated
parameterValues - the arguments of the derived typed element (in the case of a FacetOperation; can be null if there are no parameters)
Returns:
the derived typed element result: a single Object in the case of a single-valued derived typed element, or a List in the case of a multi-valued derived typed element.
Throws:
DerivedTypedElementException -
  • in case of error in the derived typed element
  • in case of error when evaluating the derived typed element

evaluate

java.lang.Object evaluate(Query query,
                          EObject source,
                          java.util.List<ParameterValue> parameterValues,
                          IFacetManager facetManager)
                          throws DerivedTypedElementException
Evaluates a query on a model element. Calling this method is discouraged. You should evaluate a DerivedTypedElements (which contains a query) instead of trying to evaluate a Query directly. Since the source type, return type and multiplicity of a query are carried by the DerivedTypedElement that normally contains it, this method doesn't check the source type, return type or multiplicity.

Parameters:
query - the query to evaluate
source - the model element on which the query must be evaluated
parameterValues - the arguments of the query (in the case of a query for a FacetOperation; can be null if there are no parameters)
Returns:
the query result: may be a single Object or a List.
Throws:
DerivedTypedElementException - if the evaluation failed

evaluateSingleValued

<T> T evaluateSingleValued(DerivedTypedElement derivedTE,
                           EObject source,
                           java.util.List<ParameterValue> parameterValues,
                           java.lang.Class<T> resultType,
                           IFacetManager facetManager)
                       throws DerivedTypedElementException
Evaluates a single valued derived typed element on a model element.

Parameters:
derivedTE - the derived typed element to evaluate
source - the model element on which the derived typed element is evaluated
parameterValues - the arguments of the derived typed element (in the case of a FacetOperation; can be null if there are no parameters)
resultType - the type that the returned value must have
Returns:
the result of the evaluation
Throws:
DerivedTypedElementException -
  • in case of error in the derived typed element
  • in case of error when evaluating the derived typed element
  • if the effective return type does not match the expected type

evaluateMultiValued

<T> java.util.List<T> evaluateMultiValued(DerivedTypedElement derivedTE,
                                          EObject source,
                                          java.util.List<ParameterValue> parameterValues,
                                          java.lang.Class<T> resultType,
                                          IFacetManager facetManager)
                                      throws DerivedTypedElementException
Evaluates a multi-valued derived typed element on a model element.

Parameters:
derivedTypedElement - the derived typed element to evaluate
source - the model element on which the derived typed element must be evaluated
parameterValues - the arguments of the derived typed element (in the case of a FacetOperation; can be null if there are no parameters)
resultType - the type that the returned value must have
Returns:
the result of the evaluation
Throws:
DerivedTypedElementException -
  • in case of error in the derived typed element
  • in case of error when evaluating the derived typed element
  • if the effective return type does not match the expected type

batchEvaluate

<T extends ETypedElementResult> java.util.List<T> batchEvaluate(DerivedTypedElement derivedTE,
                                                                java.util.Collection<? extends EObject> sources,
                                                                java.util.List<ParameterValue> parameterValues,
                                                                java.lang.Class<T> resultType,
                                                                IFacetManager facetManager)
                                                            throws DerivedTypedElementException
Evaluates a derived typed element on a list of model elements in a single call.

Parameters:
derivedTE - the derived typed element to evaluate
sources - the model elements on which the derived typed element must be evaluated
parameterValues - the arguments of the derived typed element (in the case of a FacetOperation; can be null if there are no parameters)
resultType - the expected type of the returned list:
  • DerivedTypedElementEObjectResult if the DerivedTypedElement is a single-valued EReference or EOperation that returns EObjects
  • DerivedTypedElementEObjectListResult if the DerivedTypedElement is a multi-valued EReference or EOperation that returns EObjects
  • DerivedTypedElementPrimitiveTypeResult if the DerivedTypedElement is a single-valued EAttribute or EOperation that returns a primitive type value
  • DerivedTypedElementPrimitiveTypeListResult if the DerivedTypedElement is a multi-valued EAttribute or EOperation that returns a list of primitive type values
Returns:
one derived typed element result for each source element that was evaluated
Throws:
DerivedTypedElementException -
  • in case of error in the derived typed element. Note: an error that happens when evaluating the derived typed element on any of the given sources is not thrown but stored in the corresponding element result.
  • if the effective return type does not match the expected type