Package org.eclipse.m2m.atl.engine.emfvm.adapter

# 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 Object implements IModelAdapter
The model adapter dedicated to EMF.

## Constructor Summary

Constructors
Constructor
Description
`EMFModelAdapter()`
Creates an EMF model adapter.

## Method Summary

Modifier and Type
Method
Description
`void`
`delete(AbstractStackFrame frame, Object modelElement)`
Deletes an object on the given frame.
`void`
`finalizeModel(IModel model)`
Finalizes the given model.
`Object`
`get(AbstractStackFrame frame, Object modelElement, String name)`
Gets a value from an object in the given frame.
`static org.eclipse.emf.ecore.EEnumLiteral`
`getEENumLiteral(org.eclipse.emf.ecore.EEnum eEnum, String id)`
Returns the literal matching the given name or literal.
`Object`
`getID(Object element)`
Returns the element id.
`static Object`
`getNameOf(org.eclipse.emf.ecore.EObject eo)`
Returns the name of an eObject.
`List<Object>`
`getSupertypes(Object type)`
Returns the list of supertypes of a given type.
`Object`
`getType(Object value)`
Returns the type of a given element.
`Object`
`invoke(Method method, Object self, Object[] arguments)`
Invokes a method.
`boolean`
`isDeleted(Object element)`
Checks if an elements has been deleted in refining mode and does not belong to any resource.
`boolean`
`isMetametaElement(Object element)`
Returns `true` if the given element is managed by the metametamodel of the current model adapter.
`boolean`
`isModelElement(Object o)`
Returns `true` if the given object is managed by the current model adapter.
`boolean`
`prettyPrint(ExecEnv execEnv, PrintStream out, Object value)`
Displays in a readable format the given object.
`void`
`registerVMSupertypes(Map<Class<?>,List<Class<?>>> vmSupertypes)`
Registers a map of supertypes.
`void`
`registerVMTypeOperations(Map<Object,Map<String,Operation>> vmTypeOperations)`
Registers a map of operations.
`void`
`set(AbstractStackFrame frame, Object modelElement, String name, Object value)`
Sets a value on an object in the given frame.
`void`
`setAllowInterModelReferences(boolean allowInterModelRefs)`
Sets "allow inter-model references" for this model adapter.
`void`
`setID(Object element, Object id)`
Sets the element id.
`void`
`unSet(AbstractStackFrame frame, Object modelElement, String name)`
Unsets a value on an object in the given frame.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EMFModelAdapter

public EMFModelAdapter()
Creates an EMF model adapter.

## Method Details

### setAllowInterModelReferences

public void setAllowInterModelReferences(boolean allowInterModelRefs)
Sets "allow inter-model references" for this model adapter.

Specified by:
  `setAllowInterModelReferences` in interface `IModelAdapter`
Parameters:
  `allowInterModelRefs` - the parameter value

### getNameOf

public static 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, String id)
Returns the literal matching the given name or literal.

Parameters:
  `eEnum` - the enumeration
  `id` - the name or the literal
Returns:
  the literal

### getSupertypes

public List<Object> getSupertypes(Object type)
Returns the list of supertypes of a given type.

Specified by:
  `getSupertypes` in interface `IModelAdapter`
Parameters:
  `type` - the type
Returns:
  the list of supertypes
See Also:
  - `IModelAdapter.getSupertypes(java.lang.Object)`

### getType

public Object getType(Object value)
Returns the type of a given element.

Specified by:
  `getType` in interface `IModelAdapter`
Parameters:
  `value` - the type
Returns:
  the type
See Also:
  - `IModelAdapter.getType(java.lang.Object)`

### prettyPrint

public boolean prettyPrint(ExecEnv execEnv, PrintStream out, Object value)
Displays in a readable format the given object.

Specified by:
  `prettyPrint` in interface `IModelAdapter`
Parameters:
  `execEnv` - the current execEnv
  `out` - the output stream
  `value` - 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(Map<Class<?>,List<Class<?>>> vmSupertypes)
Registers a map of supertypes.

Specified by:
  `registerVMSupertypes` in interface `IModelAdapter`
Parameters:
  `vmSupertypes` - the map
See Also:
  - `IModelAdapter.registerVMSupertypes(java.util.Map)`

### registerVMTypeOperations

public void registerVMTypeOperations(Map<Object,Map<String,Operation>> vmTypeOperations)
Registers a map of operations.

Specified by:
  `registerVMTypeOperations` in interface `IModelAdapter`
Parameters:
  `vmTypeOperations` - the map
See Also:
  - `IModelAdapter.registerVMTypeOperations(java.util.Map)`

### get

public Object get(AbstractStackFrame frame, Object modelElement, String name)
Gets a value from an object in the given frame.

Specified by:
  `get` in interface `IModelAdapter`
Parameters:
  `frame` - the `AbstractStackFrame`
  `modelElement` - the object
  `name` - 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, Object modelElement, String name, Object value)
Sets a value on an object in the given frame.

Specified by:
  `set` in interface `IModelAdapter`
Parameters:
  `frame` - the `AbstractStackFrame`
  `modelElement` - the object
  `name` - the name of the attribute / feature which will contain the value
  `value` - 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, Object modelElement, String name)
Unsets a value on an object in the given frame.

Specified by:
  `unSet` in interface `IModelAdapter`
Parameters:
  `frame` - the `AbstractStackFrame`
  `modelElement` - the object
  `name` - 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, Object modelElement)
Deletes an object on the given frame.

Specified by:
  `delete` in interface `IModelAdapter`
Parameters:
  `frame` - the `AbstractStackFrame`
  `modelElement` - the object to delete
See Also:
  - `IModelAdapter.delete(org.eclipse.m2m.atl.engine.emfvm.lib.AbstractStackFrame, java.lang.Object)`

### invoke

public Object invoke(Method method, Object self, Object[] arguments)
Invokes a method.

Specified by:
  `invoke` in interface `IModelAdapter`
Parameters:
  `method` - the method to invoke
  `self` - the object context
  `arguments` - 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:
  `finalizeModel` in interface `IModelAdapter`
Parameters:
  `model` - the given model
See Also:
  - `IModelAdapter.finalizeModel(org.eclipse.m2m.atl.core.IModel)`

### getID

public Object getID(Object element)
Returns the element id.

Specified by:
  `getID` in interface `IModelAdapter`
Parameters:
  `element` - the element
Returns:
  the element id
See Also:
  - `IModelAdapter.getID(java.lang.Object)`

### isDeleted

public boolean isDeleted(Object element)
Checks if an elements has been deleted in refining mode and does not belong to any resource.

Specified by:
  `isDeleted` in interface `IModelAdapter`
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(Object element, Object id)
Sets the element id.

Specified by:
  `setID` in interface `IModelAdapter`
Parameters:
  `element` - the element
  `id` - the id to set
See Also:
  - `IModelAdapter.setID(java.lang.Object, java.lang.Object)`

### isModelElement

public boolean isModelElement(Object o)
Returns `true` if the given object is managed by the current model adapter.

Specified by:
  `isModelElement` in interface `IModelAdapter`
Parameters:
  `o` - the given object
Returns:
  `true` if the given object is managed by the current model adapter
See Also:
  - `IModelAdapter.isModelElement(java.lang.Object)`

### isMetametaElement

public boolean isMetametaElement(Object element)
Returns `true` if the given element is managed by the metametamodel of the current model adapter.

Specified by:
  `isMetametaElement` in interface `IModelAdapter`
Parameters:
  `element` - the given element
Returns:
  `true` if the given element is managed by the metametamodel of the current model adapter
See Also:
  - `IModelAdapter.isMetametaElement(java.lang.Object)`