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


public interface IFacetManager

This interface allows clients to use the EMF Facet API to get and set the values of virtually added EReferences and EAttributes, and invoke EOperations.

Derived FacetAttributes and FacetReferences are computed by queries, whereas non-derived FacetAttributes and EAttributes and EReferences and FacetReferences are stored in the serialization Resource specified in the IFacetManagerFactory that created this IFacetManager.

Since:
0.2

Method Summary
<T> java.util.List<ETypedElementResult>
batchGetOrInvoke(java.util.Collection<EObject> sources, ETypedElement query, java.lang.Class<T> aClass)
           
 java.util.List<ETypedElementResult> batchInvoke(java.util.Collection<EObject> eObjects, EOperation operation, java.lang.Object... arguments)
          Invoke the given EOperation on each element of the given collection of EObjects.
 java.util.List<FacetSet> getManagedFacetSets()
          This method returns the list of loaded facet sets.
<T> T
getOrInvoke(EObject element, ETypedElement query, java.lang.Class<T> aClass)
           
<T> java.util.List<T>
getOrInvokeMultiValued(EObject eObject, ETypedElement feature, java.lang.Class<T> aClass)
           
 ResourceSet getResourceSet()
           
<T> T
invoke(EObject eObject, EOperation operation, java.lang.Class<T> resultType, EditingDomain editingDomain, java.lang.Object... arguments)
          Evaluate the given EOperation of the given EObject.
 boolean isConforming(EObject eObject, Facet facet)
          Returns whether the given model element conforms to the given Facet
 void saveStructuralFeatureInstanceModel()
          Serialize the model containing the structural feature instances.
 void set(EObject eObject, EStructuralFeature structuralFeature, java.lang.Object newValue, EditingDomain editingDomain)
          Set the value of the given EStructuralFeature on the given EObject to the given Object value.
 

Method Detail

saveStructuralFeatureInstanceModel

void saveStructuralFeatureInstanceModel()
                                        throws FacetManagerException
Serialize the model containing the structural feature instances.

Throws:
FacetManagerException

isConforming

boolean isConforming(EObject eObject,
                     Facet facet)
                     throws FacetManagerException
Returns whether the given model element conforms to the given Facet

Parameters:
eObject - the model element
facet - the Facet the applicability of which is being tested
Returns:
whether the given model element should be seen as an instance of the given Facet
Throws:
FacetManagerException - if there is an error evaluating the Facet's conformance typed element

set

void set(EObject eObject,
         EStructuralFeature structuralFeature,
         java.lang.Object newValue,
         EditingDomain editingDomain)
         throws FacetManagerException
Set the value of the given EStructuralFeature on the given EObject to the given Object value.

Parameters:
eObject - the model element whose feature must be set
structuralFeature - the feature to set
newValue - the new value
editingDomain -
Throws:
FacetManagerException -
  • if the eObject doesn't conform to the Facet of the given attribute (in the case of a FacetAttribute)
  • if the Facet of the given attribute is not applicable to the given eObject (in the case of a FacetAttribute)
  • if there is an error evaluating the Facet's conformance typed element

invoke

<T> T invoke(EObject eObject,
             EOperation operation,
             java.lang.Class<T> resultType,
             EditingDomain editingDomain,
             java.lang.Object... arguments)
         throws FacetManagerException
Evaluate the given EOperation of the given EObject. The returned value has to be of the given expectedType Class

Parameters:
eObject - the model element on which the operation is evaluated
operation - the operation to evaluate
resultType - the expected type of the returned value; if the effective type is not compatible, an UnmatchingExpectedTypeException will be thrown
arguments - the values of the parameters of the EOperation that is evaluated: they must match both in size, types and multiplicity
Returns:
the return value of the operation
Throws:
FacetManagerException -
  • if the effective type does not match the expected type
  • in case of an error in the query that returns the value (can only happen in the case of a FacetOperation)
  • in case of an error when delegating to the Ecore reflexive API (if the given EOperation is not a FacetOperation)
  • if the eObject doesn't conform to the Facet of the given operation (in the case of a FacetOperation)
  • if the Facet of the given operation is not applicable to the given eObject (in the case of a FacetOperation)
  • if there is an error evaluating the Facet's conformance typed element
  • if the given actual parameters don't match the EOperation's formal parameters

batchInvoke

java.util.List<ETypedElementResult> batchInvoke(java.util.Collection<EObject> eObjects,
                                                EOperation operation,
                                                java.lang.Object... arguments)
                                                throws FacetManagerException
Invoke the given EOperation on each element of the given collection of EObjects.

Parameters:
eObjects - the model elements on which the operation is evaluated
operation - the operation to evaluate
arguments - the values of the parameters of the EOperation that is evaluated: they must match both in size, types and multiplicity
Returns:
the list of results, one for each model element of the given eObjects
Throws:
FacetManagerException -
  • in case of an error when delegating to the Ecore reflexive API (if the given EOperation is not a FacetOperation)
  • in case of an error in the derived typed element that returns the value

getManagedFacetSets

java.util.List<FacetSet> getManagedFacetSets()
This method returns the list of loaded facet sets.

Returns:
a modifiable list of all FacetSets that constitute the working context of the FacetManager

getResourceSet

ResourceSet getResourceSet()
Returns:
the resourceSet used to manage the facet models.

getOrInvoke

<T> T getOrInvoke(EObject element,
                  ETypedElement query,
                  java.lang.Class<T> aClass)
              throws FacetManagerException
Throws:
FacetManagerException

getOrInvokeMultiValued

<T> java.util.List<T> getOrInvokeMultiValued(EObject eObject,
                                             ETypedElement feature,
                                             java.lang.Class<T> aClass)
                                         throws FacetManagerException
Throws:
FacetManagerException

batchGetOrInvoke

<T> java.util.List<ETypedElementResult> batchGetOrInvoke(java.util.Collection<EObject> sources,
                                                         ETypedElement query,
                                                         java.lang.Class<T> aClass)
                                                     throws FacetManagerException
Throws:
FacetManagerException