org.camunda.bpm.model.xml.impl
Class ModelInstanceImpl

java.lang.Object
  extended by org.camunda.bpm.model.xml.impl.ModelInstanceImpl
All Implemented Interfaces:
ModelInstance

public class ModelInstanceImpl
extends Object
implements ModelInstance

An instance of a model

Author:
Daniel Meyer, Sebastian Menski

Constructor Summary
ModelInstanceImpl(ModelImpl model, ModelBuilder modelBuilder, DomDocument document)
           
 
Method Summary
 Object clone()
          Clones the model instance but not the model.
 DomDocument getDocument()
          Returns the wrapped DomDocument.
 ModelElementInstance getDocumentElement()
          Returns the ModelElement corresponding to the document element of this model or null if no document element exists.
 Model getModel()
          Returns the underlying model.
<T extends ModelElementInstance>
T
getModelElementById(String id)
          Find a unique element of the model by id.
<T extends ModelElementInstance>
Collection<T>
getModelElementsByType(Class<T> referencingClass)
          Find all elements of a type.
 Collection<ModelElementInstance> getModelElementsByType(ModelElementType type)
          Find all elements of a type.
<T extends ModelElementInstance>
T
newInstance(Class<T> type)
          Creates a new instance of type class.
<T extends ModelElementInstance>
T
newInstance(ModelElementType type)
          Creates a new instance of type.
 ModelElementType registerGenericType(String namespaceUri, String localName)
           
 void setDocumentElement(ModelElementInstance modelElement)
          Updates the document element.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelInstanceImpl

public ModelInstanceImpl(ModelImpl model,
                         ModelBuilder modelBuilder,
                         DomDocument document)
Method Detail

getDocument

public DomDocument getDocument()
Description copied from interface: ModelInstance
Returns the wrapped DomDocument.

Specified by:
getDocument in interface ModelInstance
Returns:
the DOM document

getDocumentElement

public ModelElementInstance getDocumentElement()
Description copied from interface: ModelInstance
Returns the ModelElement corresponding to the document element of this model or null if no document element exists.

Specified by:
getDocumentElement in interface ModelInstance
Returns:
the document element or null

setDocumentElement

public void setDocumentElement(ModelElementInstance modelElement)
Description copied from interface: ModelInstance
Updates the document element.

Specified by:
setDocumentElement in interface ModelInstance
Parameters:
modelElement - the new document element to set

newInstance

public <T extends ModelElementInstance> T newInstance(Class<T> type)
Description copied from interface: ModelInstance
Creates a new instance of type class.

Specified by:
newInstance in interface ModelInstance
Type Parameters:
T - instance type
Parameters:
type - the class of the type to create
Returns:
the new created instance

newInstance

public <T extends ModelElementInstance> T newInstance(ModelElementType type)
Description copied from interface: ModelInstance
Creates a new instance of type.

Specified by:
newInstance in interface ModelInstance
Type Parameters:
T - instance type
Parameters:
type - the type to create
Returns:
the new created instance

getModel

public Model getModel()
Description copied from interface: ModelInstance
Returns the underlying model.

Specified by:
getModel in interface ModelInstance
Returns:
the model

registerGenericType

public ModelElementType registerGenericType(String namespaceUri,
                                            String localName)

getModelElementById

public <T extends ModelElementInstance> T getModelElementById(String id)
Description copied from interface: ModelInstance
Find a unique element of the model by id.

Specified by:
getModelElementById in interface ModelInstance
Parameters:
id - the id of the element
Returns:
the element with the id or null

getModelElementsByType

public Collection<ModelElementInstance> getModelElementsByType(ModelElementType type)
Description copied from interface: ModelInstance
Find all elements of a type.

Specified by:
getModelElementsByType in interface ModelInstance
Parameters:
type - the type of the elements
Returns:
the collection of elements of the type

getModelElementsByType

public <T extends ModelElementInstance> Collection<T> getModelElementsByType(Class<T> referencingClass)
Description copied from interface: ModelInstance
Find all elements of a type.

Specified by:
getModelElementsByType in interface ModelInstance
Parameters:
referencingClass - the type class of the elements
Returns:
the collection of elements of the type

clone

public Object clone()
Clones the model instance but not the model. So only the wrapped DOM document is cloned. Changes of the model are persistent between multiple model instances.

Overrides:
clone in class Object
Returns:
the new model instance


Copyright © 2015 camunda services GmbH. All rights reserved.