Interface ReferenceManager
-
public interface ReferenceManager
Registers references to build in the output model once input elements have corresponding primary output elements.When transforming an input model into an output model, the developer needs to create relations between elements part of the output model corresponding to relations part of the input model. However source and target elements might not yet exist in the output model by the time the developer identifies the relations to create, depending on the navigation order in the input model. The
ReferenceManager
enables to register references to create and to delay the actual creation by the time source and target elements exist in the output model.It is the developer responsibility to execute a builder operation to create references in the output model. A build operation is to execute at least once at the end of the transformation. It shall be executed multiple times, at various stages of the transformation, if desired.
This interface is not intended to be implemented by clients.
- Since:
- 3.6.0
- See Also:
ObjectMapping.setPrimary(EObject)
,Mapping.getReferences()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(Collection<? extends org.eclipse.emf.ecore.EObject> inputs, Runnable referenceBuilder)
Registers aRunnable
instance to execute when the specified input elements all have corresponding primary output elements.void
add(org.eclipse.emf.ecore.EObject input, Runnable referenceBuilder)
Registers aRunnable
instance to execute when the specified input element has a corresponding primary output element.void
add(org.eclipse.emf.ecore.EObject source, Collection<? extends org.eclipse.emf.ecore.EObject> targets, org.eclipse.emf.ecore.EReference outputReference)
Registers references to create in the output model when the specified source and target input elements have corresponding primary output elements.void
add(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EReference outputReference)
Registers a reference to create in the output model when the specified source and target input elements have corresponding primary output elements.Operation
createBuilder()
Creates a build operation to create references in the output model.
-
-
-
Method Detail
-
add
void add(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EReference outputReference)
Registers a reference to create in the output model when the specified source and target input elements have corresponding primary output elements.- Parameters:
source
- the source element, part of the input model.target
- the target element, part of the input model.outputReference
- the reference to create between corresponding primary source and target elements in the output model, once they exist.- See Also:
ObjectMapping.setPrimary(EObject)
-
add
void add(org.eclipse.emf.ecore.EObject source, Collection<? extends org.eclipse.emf.ecore.EObject> targets, org.eclipse.emf.ecore.EReference outputReference)
Registers references to create in the output model when the specified source and target input elements have corresponding primary output elements.Note that the builder operation will create references whose source and target elements exist in the output model. References whose source and target elements are not know by the time the operation is executed remain registered in the manager.
- Parameters:
source
- the source element, part of the input model.targets
- the target elements, part of the input model.outputReference
- the reference to create between corresponding primary source and target elements in the output model, once they exist.- See Also:
ObjectMapping.setPrimary(EObject)
-
add
void add(org.eclipse.emf.ecore.EObject input, Runnable referenceBuilder)
Registers aRunnable
instance to execute when the specified input element has a corresponding primary output element. This method enables to execute an arbitrary piece of code, for more complex situations where not a simple reference is to create but potentially a set of objects.- Parameters:
input
- an element part of the input model.referenceBuilder
- the block of code to execute once the primary output element corresponding to the specified input element is known.- See Also:
ObjectMapping.setPrimary(EObject)
-
add
void add(Collection<? extends org.eclipse.emf.ecore.EObject> inputs, Runnable referenceBuilder)
Registers aRunnable
instance to execute when the specified input elements all have corresponding primary output elements. This method enables to execute an arbitrary piece of code, for more complex situations where not a simple reference is to create but potentially a set of objects.- Parameters:
inputs
- elements part of the input model.referenceBuilder
- the block of code to execute once all primary output elements corresponding to the specified input elements are known.- See Also:
ObjectMapping.setPrimary(EObject)
-
createBuilder
Operation createBuilder()
Creates a build operation to create references in the output model. The returned operation, when executed by the caller, will identify all source and target elements existing in the output model for which a reference can be created. References whose source and target elements are not known by the time the operation is executed remain registered in the manager.- Returns:
- a build operation to create references in the output model.
-
-