Class EMFModel

java.lang.Object
org.eclipse.m2m.atl.core.emf.EMFModel
All Implemented Interfaces:
IModel
Direct Known Subclasses:
AtlResourceImpl.EMFModelWrapper, EMFReferenceModel

public class EMFModel extends Object implements IModel
The EMF implementation of IModel.
  • Field Details

    • referenceModel

      protected EMFReferenceModel referenceModel
      The metamodel.
    • elementsByType

      protected Map<org.eclipse.emf.ecore.EClass,Set<org.eclipse.emf.ecore.EObject>> elementsByType
  • Constructor Details

  • Method Details

    • newElement

      public Object newElement(Object metaElement)
      Creates a new element in the model.
      Specified by:
      newElement in interface IModel
      Parameters:
      metaElement - the new element metatype
      Returns:
      the newly created element
      See Also:
    • getReferenceModel

      public EMFReferenceModel getReferenceModel()
      Returns the IReferenceModel (i.e. the metamodel).
      Specified by:
      getReferenceModel in interface IModel
      Returns:
      the IReferenceModel
      See Also:
    • getElementsByType

      public Set<org.eclipse.emf.ecore.EObject> getElementsByType(Object metaElement)
      Returns a Set of the elements matching the given type.
      Specified by:
      getElementsByType in interface IModel
      Parameters:
      metaElement - a metatype
      Returns:
      a Set of the elements matching the given type
      See Also:
    • isTarget

      public boolean isTarget()
      Defines if the model is readonly or not.
      Specified by:
      isTarget in interface IModel
      Returns:
      true if the model allows writing
      See Also:
    • setIsTarget

      public void setIsTarget(boolean value)
      Sets if the model is readonly or not.
      Specified by:
      setIsTarget in interface IModel
      Parameters:
      value - true if the model allows writing
      See Also:
    • getResource

      public org.eclipse.emf.ecore.resource.Resource getResource()
      Returns the resource.
      Returns:
      the resource
    • setResource

      protected void setResource(org.eclipse.emf.ecore.resource.Resource resource)
      Sets the resource with the resource value.
      Parameters:
      resource - the resource to set
    • getModelFactory

      public EMFModelFactory getModelFactory()
      Returns the ModelFactory used to create the current model.
      Specified by:
      getModelFactory in interface IModel
      Returns:
      true if the model allows writing
      See Also:
    • commitToResource

      public void commitToResource()
      Finalizes the model.
    • isModelOf

      public boolean isModelOf(Object object)
      Returns true if the given object is contained in this model's resource or a referenced resource.
      Specified by:
      isModelOf in interface IModel
      Parameters:
      object - the model element
      Returns:
      true if object is contained in this model's resource or a referenced resource
      See Also:
    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
      See Also: