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()
ModelInstanceDomDocument.getDocument in interface ModelInstancepublic ModelElementInstance getDocumentElement()
ModelInstanceModelElement corresponding to the document
element of this model or null if no document element exists.getDocumentElement in interface ModelInstancepublic void setDocumentElement(ModelElementInstance modelElement)
ModelInstancesetDocumentElement in interface ModelInstancemodelElement - the new document element to setpublic <T extends ModelElementInstance> T newInstance(Class<T> type)
ModelInstancenewInstance in interface ModelInstanceT - instance typetype - the class of the type to createpublic <T extends ModelElementInstance> T newInstance(Class<T> type, String id)
ModelInstancenewInstance in interface ModelInstanceT - instance typetype - the class of the type to createid - identifier of new element instancepublic <T extends ModelElementInstance> T newInstance(ModelElementType type)
ModelInstancenewInstance in interface ModelInstanceT - instance typetype - the type to createpublic <T extends ModelElementInstance> T newInstance(ModelElementType type, String id)
ModelInstancenewInstance in interface ModelInstanceT - instance typetype - the type to createid - identifier of new element instancepublic Model getModel()
ModelInstancegetModel in interface ModelInstancepublic ModelElementType registerGenericType(String namespaceUri, String localName)
public <T extends ModelElementInstance> T getModelElementById(String id)
ModelInstancegetModelElementById in interface ModelInstanceid - the id of the elementpublic Collection<ModelElementInstance> getModelElementsByType(ModelElementType type)
ModelInstancegetModelElementsByType in interface ModelInstancetype - the type of the elementspublic <T extends ModelElementInstance> Collection<T> getModelElementsByType(Class<T> referencingClass)
ModelInstancegetModelElementsByType in interface ModelInstancereferencingClass - the type class of the elementspublic ModelInstance clone()
ModelInstanceclone in interface ModelInstanceclone in class Objectpublic ValidationResults validate(Collection<ModelElementValidator<?>> validators)
ModelInstanceValidationResults
object which is returned by this method.validate in interface ModelInstancevalidators - the validators to executeCopyright © 2022. All rights reserved.