Class EMFModelAdapter
- java.lang.Object
-
- org.eclipse.m2m.atl.engine.emfvm.adapter.EMFModelAdapter
-
- All Implemented Interfaces:
IModelAdapter
- Direct Known Subclasses:
UML2ModelAdapter
public class EMFModelAdapter extends java.lang.Object implements IModelAdapter
The model adapter dedicated to EMF.
-
-
Constructor Summary
Constructors Constructor Description EMFModelAdapter()Creates an EMF model adapter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(AbstractStackFrame frame, java.lang.Object modelElement)Deletes an object on the given frame.voidfinalizeModel(IModel model)Finalizes the given model.java.lang.Objectget(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name)Gets a value from an object in the given frame.static org.eclipse.emf.ecore.EEnumLiteralgetEENumLiteral(org.eclipse.emf.ecore.EEnum eEnum, java.lang.String id)Returns the literal matching the given name or literal.java.lang.ObjectgetID(java.lang.Object element)Returns the element id.static java.lang.ObjectgetNameOf(org.eclipse.emf.ecore.EObject eo)Returns the name of an eObject.java.util.List<java.lang.Object>getSupertypes(java.lang.Object type)Returns the list of supertypes of a given type.java.lang.ObjectgetType(java.lang.Object value)Returns the type of a given element.java.lang.Objectinvoke(java.lang.reflect.Method method, java.lang.Object self, java.lang.Object[] arguments)Invokes a method.booleanisDeleted(java.lang.Object element)Checks if an elements has been deleted in refining mode and does not belong to any resource.booleanisMetametaElement(java.lang.Object element)Returnstrueif the given element is managed by the metametamodel of the current model adapter.booleanisModelElement(java.lang.Object o)Returnstrueif the given object is managed by the current model adapter.booleanprettyPrint(ExecEnv execEnv, java.io.PrintStream out, java.lang.Object value)Displays in a readable format the given object.voidregisterVMSupertypes(java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> vmSupertypes)Registers a map of supertypes.voidregisterVMTypeOperations(java.util.Map<java.lang.Object,java.util.Map<java.lang.String,Operation>> vmTypeOperations)Registers a map of operations.voidset(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name, java.lang.Object value)Sets a value on an object in the given frame.voidsetAllowInterModelReferences(boolean allowInterModelRefs)Sets "allow inter-model references" for this model adapter.voidsetID(java.lang.Object element, java.lang.Object id)Sets the element id.voidunSet(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name)Unsets a value on an object in the given frame.
-
-
-
Method Detail
-
setAllowInterModelReferences
public void setAllowInterModelReferences(boolean allowInterModelRefs)
Sets "allow inter-model references" for this model adapter.- Specified by:
setAllowInterModelReferencesin interfaceIModelAdapter- Parameters:
allowInterModelRefs- the parameter value
-
getNameOf
public static java.lang.Object getNameOf(org.eclipse.emf.ecore.EObject eo)
Returns the name of an eObject.- Parameters:
eo- the eObject- Returns:
- the name of an eObject
-
getEENumLiteral
public static org.eclipse.emf.ecore.EEnumLiteral getEENumLiteral(org.eclipse.emf.ecore.EEnum eEnum, java.lang.String id)Returns the literal matching the given name or literal.- Parameters:
eEnum- the enumerationid- the name or the literal- Returns:
- the literal
-
getSupertypes
public java.util.List<java.lang.Object> getSupertypes(java.lang.Object type)
Returns the list of supertypes of a given type.- Specified by:
getSupertypesin interfaceIModelAdapter- Parameters:
type- the type- Returns:
- the list of supertypes
- See Also:
IModelAdapter.getSupertypes(java.lang.Object)
-
getType
public java.lang.Object getType(java.lang.Object value)
Returns the type of a given element.- Specified by:
getTypein interfaceIModelAdapter- Parameters:
value- the type- Returns:
- the type
- See Also:
IModelAdapter.getType(java.lang.Object)
-
prettyPrint
public boolean prettyPrint(ExecEnv execEnv, java.io.PrintStream out, java.lang.Object value)
Displays in a readable format the given object.- Specified by:
prettyPrintin interfaceIModelAdapter- Parameters:
execEnv- the current execEnvout- the output streamvalue- the object to display- Returns:
- true if display has been successful
- See Also:
IModelAdapter.prettyPrint(org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv, java.io.PrintStream, java.lang.Object)
-
registerVMSupertypes
public void registerVMSupertypes(java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> vmSupertypes)
Registers a map of supertypes.- Specified by:
registerVMSupertypesin interfaceIModelAdapter- Parameters:
vmSupertypes- the map- See Also:
IModelAdapter.registerVMSupertypes(java.util.Map)
-
registerVMTypeOperations
public void registerVMTypeOperations(java.util.Map<java.lang.Object,java.util.Map<java.lang.String,Operation>> vmTypeOperations)
Registers a map of operations.- Specified by:
registerVMTypeOperationsin interfaceIModelAdapter- Parameters:
vmTypeOperations- the map- See Also:
IModelAdapter.registerVMTypeOperations(java.util.Map)
-
get
public java.lang.Object get(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name)
Gets a value from an object in the given frame.- Specified by:
getin interfaceIModelAdapter- Parameters:
frame- theAbstractStackFramemodelElement- the objectname- the name of the attribute / feature which contains the value- Returns:
- the value
- See Also:
IModelAdapter.get(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame, java.lang.Object, java.lang.String)
-
set
public void set(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name, java.lang.Object value)
Sets a value on an object in the given frame.- Specified by:
setin interfaceIModelAdapter- Parameters:
frame- theAbstractStackFramemodelElement- the objectname- the name of the attribute / feature which will contain the valuevalue- the value to set- See Also:
IModelAdapter.set(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame, java.lang.Object, java.lang.String, java.lang.Object)
-
unSet
public void unSet(AbstractStackFrame frame, java.lang.Object modelElement, java.lang.String name)
Unsets a value on an object in the given frame.- Specified by:
unSetin interfaceIModelAdapter- Parameters:
frame- theAbstractStackFramemodelElement- the objectname- the name of the attribute / feature which will contain the value- See Also:
IModelAdapter.unSet(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame, java.lang.Object, java.lang.String)
-
delete
public void delete(AbstractStackFrame frame, java.lang.Object modelElement)
Deletes an object on the given frame.- Specified by:
deletein interfaceIModelAdapter- Parameters:
frame- theAbstractStackFramemodelElement- the object to delete- See Also:
IModelAdapter.delete(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame, java.lang.Object)
-
invoke
public java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object self, java.lang.Object[] arguments)Invokes a method.- Specified by:
invokein interfaceIModelAdapter- Parameters:
method- the method to invokeself- the object contextarguments- the call arguments- Returns:
- the method result
- See Also:
IModelAdapter.invoke(java.lang.reflect.Method, java.lang.Object, java.lang.Object[])
-
finalizeModel
public void finalizeModel(IModel model)
Finalizes the given model.- Specified by:
finalizeModelin interfaceIModelAdapter- Parameters:
model- the given model- See Also:
IModelAdapter.finalizeModel(org.eclipse.m2m.atl.core.IModel)
-
getID
public java.lang.Object getID(java.lang.Object element)
Returns the element id.- Specified by:
getIDin interfaceIModelAdapter- Parameters:
element- the element- Returns:
- the element id
- See Also:
IModelAdapter.getID(java.lang.Object)
-
isDeleted
public boolean isDeleted(java.lang.Object element)
Checks if an elements has been deleted in refining mode and does not belong to any resource.- Specified by:
isDeletedin interfaceIModelAdapter- Parameters:
element- the element- Returns:
- ture if the element has been deleted. False otherwise.
- See Also:
IModelAdapter.isDeleted(java.lang.Object)
-
setID
public void setID(java.lang.Object element, java.lang.Object id)Sets the element id.- Specified by:
setIDin interfaceIModelAdapter- Parameters:
element- the elementid- the id to set- See Also:
IModelAdapter.setID(java.lang.Object, java.lang.Object)
-
isModelElement
public boolean isModelElement(java.lang.Object o)
Returnstrueif the given object is managed by the current model adapter.- Specified by:
isModelElementin interfaceIModelAdapter- Parameters:
o- the given object- Returns:
trueif the given object is managed by the current model adapter- See Also:
IModelAdapter.isModelElement(java.lang.Object)
-
isMetametaElement
public boolean isMetametaElement(java.lang.Object element)
Returnstrueif the given element is managed by the metametamodel of the current model adapter.- Specified by:
isMetametaElementin interfaceIModelAdapter- Parameters:
element- the given element- Returns:
trueif the given element is managed by the metametamodel of the current model adapter- See Also:
IModelAdapter.isMetametaElement(java.lang.Object)
-
-