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 `EReference`s and `EAttribute`s, and invoke `EOperation`s.

Derived `FacetAttribute`s and `FacetReference`s are computed by queries, whereas non-derived `FacetAttribute`s and `EAttribute`s and `EReference`s and `FacetReference`s are stored in the serialization `Resource` specified in the `IFacetManagerFactory` that created this `IFacetManager`.

Since:
  0.2
Noimplement:
  This interface is not intended to be implemented by clients.
Noextend:
  This interface is not intended to be extended by clients.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `addListener(IFacetManagerListener listener)` Adds a listener to this manager that will be notified when this manager's state changes.
`<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 `EObject`s.
`java.util.Set<EAttribute>` `getAttributes(EObject eObject)` Get virtual attributes from an EObject.
`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)`
`java.util.Set<EReference>` `getReferences(EObject eObject)` Get virtual references from an EObject.
`ResourceSet` `getResourceSet()`
`Resource` `getSerializationResource()`
`java.util.Set<EStructuralFeature>` `getStructuralFeature(EObject eObject)` Get virtual references and attributes from an EObject.
`<T> T` `getSuperValueOf(DerivedTypedElement derivedTypedElt, EObject source, java.util.List<ParameterValue> parameterValues, java.lang.Class<T> expectedType)`
`<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` `removeListener(IFacetManagerListener listener)` Removes a listener from this manager.
`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.
`void` `setSerializationResource(Resource resource)`

### 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 `EObject`s.

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`

#### getReferences

    java.util.Set<EReference> getReferences(EObject eObject)
                                     throws FacetManagerException

Get virtual references from an EObject. References must be defined in a FacetSet

Parameters:
  `eObject` - Model element
Returns:
  All not duplicated virtual references
Throws:
  `FacetManagerException`
Since:
  0.4

#### getAttributes

    java.util.Set<EAttribute> getAttributes(EObject eObject)
                                     throws FacetManagerException

Get virtual attributes from an EObject. References must be defined in a FacetSet

Parameters:
  `eObject` - Model element
Returns:
  All not duplicated virtual attributes
Throws:
  `FacetManagerException`
Since:
  0.4

#### getStructuralFeature

    java.util.Set<EStructuralFeature> getStructuralFeature(EObject eObject)
                                                    throws FacetManagerException

Get virtual references and attributes from an EObject. References must be defined in a FacetSet

Parameters:
  `eObject` - Model element
Returns:
  All not duplicated virtual references and attributes
Throws:
  `FacetManagerException`
Since:
  0.4

#### addListener

    void addListener(IFacetManagerListener listener)

Adds a listener to this manager that will be notified when this manager's state changes.

Parameters:
  `listener` - The listener to be added
Since:
  0.4

#### removeListener

    void removeListener(IFacetManagerListener listener)

Removes a listener from this manager.

Parameters:
  `listener` - The listener to be removed
Since:
  0.4

#### getSuperValueOf

    <T> T getSuperValueOf(DerivedTypedElement derivedTypedElt,
                          EObject source,
                          java.util.List<ParameterValue> parameterValues,
                          java.lang.Class<T> expectedType)
                   throws SuperInvokeException,
                          FacetManagerException

Throws:
  `SuperInvokeException`
  `FacetManagerException`
Since:
  1.0

#### getSerializationResource

    Resource getSerializationResource()

Since:
  1.0

#### setSerializationResource

    void setSerializationResource(Resource resource)
                           throws FacetManagerException

Throws:
  `FacetManagerException`
Since:
  1.0