public class ModelInstanceImpl extends Object implements ModelInstance
Modifier and Type | Field and Description |
---|---|
protected DomDocument |
document |
protected ModelImpl |
model |
protected ModelBuilder |
modelBuilder |
Constructor and Description |
---|
ModelInstanceImpl(ModelImpl model,
ModelBuilder modelBuilder,
DomDocument document) |
Modifier and Type | Method and Description |
---|---|
ModelInstance |
clone()
Copies 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> |
getModelElementById(String id)
Find a unique element of the model by id.
|
<T extends ModelElementInstance> |
getModelElementsByType(Class<T> referencingClass)
Find all elements of a type.
|
Collection<ModelElementInstance> |
getModelElementsByType(ModelElementType type)
Find all elements of a type.
|
<T extends ModelElementInstance> |
newInstance(Class<T> type)
Creates a new instance of type class.
|
<T extends ModelElementInstance> |
newInstance(Class<T> type,
String id)
Creates a new instance of type class with user-defined id.
|
<T extends ModelElementInstance> |
newInstance(ModelElementType type)
Creates a new instance of type.
|
<T extends ModelElementInstance> |
newInstance(ModelElementType type,
String id)
Creates a new instance of type with user-defined id.
|
ModelElementType |
registerGenericType(String namespaceUri,
String localName) |
void |
setDocumentElement(ModelElementInstance modelElement)
Updates the document element.
|
ValidationResults |
validate(Collection<ModelElementValidator<?>> validators)
Validate semantic properties of this model instance using a collection of validators.
|
protected final DomDocument document
protected ModelImpl model
protected final ModelBuilder modelBuilder
public ModelInstanceImpl(ModelImpl model, ModelBuilder modelBuilder, DomDocument document)
public DomDocument getDocument()
ModelInstance
DomDocument
.getDocument
in interface ModelInstance
public ModelElementInstance getDocumentElement()
ModelInstance
ModelElement
corresponding to the document
element of this model or null if no document element exists.getDocumentElement
in interface ModelInstance
public void setDocumentElement(ModelElementInstance modelElement)
ModelInstance
setDocumentElement
in interface ModelInstance
modelElement
- the new document element to setpublic <T extends ModelElementInstance> T newInstance(Class<T> type)
ModelInstance
newInstance
in interface ModelInstance
T
- instance typetype
- the class of the type to createpublic <T extends ModelElementInstance> T newInstance(Class<T> type, String id)
ModelInstance
newInstance
in interface ModelInstance
T
- instance typetype
- the class of the type to createid
- identifier of new element instancepublic <T extends ModelElementInstance> T newInstance(ModelElementType type)
ModelInstance
newInstance
in interface ModelInstance
T
- instance typetype
- the type to createpublic <T extends ModelElementInstance> T newInstance(ModelElementType type, String id)
ModelInstance
newInstance
in interface ModelInstance
T
- instance typetype
- the type to createid
- identifier of new element instancepublic Model getModel()
ModelInstance
getModel
in interface ModelInstance
public ModelElementType registerGenericType(String namespaceUri, String localName)
public <T extends ModelElementInstance> T getModelElementById(String id)
ModelInstance
getModelElementById
in interface ModelInstance
id
- the id of the elementpublic Collection<ModelElementInstance> getModelElementsByType(ModelElementType type)
ModelInstance
getModelElementsByType
in interface ModelInstance
type
- the type of the elementspublic <T extends ModelElementInstance> Collection<T> getModelElementsByType(Class<T> referencingClass)
ModelInstance
getModelElementsByType
in interface ModelInstance
referencingClass
- the type class of the elementspublic ModelInstance clone()
ModelInstance
clone
in interface ModelInstance
clone
in class Object
public ValidationResults validate(Collection<ModelElementValidator<?>> validators)
ModelInstance
ValidationResults
object which is returned by this method.validate
in interface ModelInstance
validators
- the validators to executeCopyright © 2021. All rights reserved.