public final class ModelUtil extends Object
Constructor and Description |
---|
ModelUtil() |
Modifier and Type | Method and Description |
---|---|
static Collection<ModelElementType> |
calculateAllBaseTypes(ModelElementType type)
Calculate a collection of all base types for the given type
|
static Collection<ModelElementType> |
calculateAllExtendingTypes(Model model,
Collection<ModelElementType> baseTypes)
Calculate a collection of all extending types for the given base types
|
static void |
ensureInstanceOf(Object instance,
Class<?> type) |
static int |
getIndexOfElementType(ModelElementInstance modelElement,
List<ModelElementType> childElementTypes)
Find the index of the type of a model element in a list of element types
|
static ModelElementInstance |
getModelElement(DomElement domElement,
ModelInstanceImpl modelInstance)
Returns the
ModelElement for a DOM element. |
static ModelElementInstance |
getModelElement(DomElement domElement,
ModelInstanceImpl modelInstance,
ModelElementTypeImpl modelType)
Returns the
ModelElement for a DOM element. |
protected static ModelElementTypeImpl |
getModelElement(DomElement domElement,
ModelInstanceImpl modelInstance,
String namespaceUri) |
static <T extends ModelElementInstance> |
getModelElementCollection(Collection<DomElement> view,
ModelInstanceImpl model)
Get a collection of all model element instances in a view
|
static QName |
getQName(String namespaceUri,
String localName) |
static String |
getUniqueIdentifier(ModelElementType type) |
static void |
setGeneratedUniqueIdentifier(ModelElementType type,
ModelElementInstance modelElementInstance)
Set unique identifier if the type has a String id attribute
|
static void |
setGeneratedUniqueIdentifier(ModelElementType type,
ModelElementInstance modelElementInstance,
boolean withReferenceUpdate)
Set unique identifier if the type has a String id attribute
|
static void |
setNewIdentifier(ModelElementType type,
ModelElementInstance modelElementInstance,
String newId,
boolean withReferenceUpdate)
Set new identifier if the type has a String id attribute
|
static boolean |
valueAsBoolean(String rawValue) |
static double |
valueAsDouble(String rawValue) |
static float |
valueAsFloat(String rawValue) |
static int |
valueAsInteger(String rawValue) |
static short |
valueAsShort(String rawValue) |
static String |
valueAsString(boolean booleanValue) |
static String |
valueAsString(double doubleValue) |
static String |
valueAsString(float floatValue) |
static String |
valueAsString(int integerValue) |
static String |
valueAsString(short shortValue) |
public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance)
ModelElement
for a DOM element.
If the model element does not yet exist, it is created and linked to the DOM.domElement
- the child element to create a new ModelElement
forpublic static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType)
ModelElement
for a DOM element.
If the model element does not yet exist, it is created and linked to the DOM.domElement
- the child element to create a new ModelElement
formodelInstance
- the ModelInstance
for which the new ModelElement
is createdmodelType
- the ModelElementType
to create a new ModelElement
forprotected static ModelElementTypeImpl getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, String namespaceUri)
public static boolean valueAsBoolean(String rawValue)
public static int valueAsInteger(String rawValue)
public static float valueAsFloat(String rawValue)
public static double valueAsDouble(String rawValue)
public static short valueAsShort(String rawValue)
public static String valueAsString(boolean booleanValue)
public static String valueAsString(int integerValue)
public static String valueAsString(float floatValue)
public static String valueAsString(double doubleValue)
public static String valueAsString(short shortValue)
public static <T extends ModelElementInstance> Collection<T> getModelElementCollection(Collection<DomElement> view, ModelInstanceImpl model)
view
- the collection of DOM elements to find the model element instances formodel
- the model of the elementspublic static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes)
modelElement
- the model element which type is searched forchildElementTypes
- the list to search the typepublic static Collection<ModelElementType> calculateAllExtendingTypes(Model model, Collection<ModelElementType> baseTypes)
baseTypes
- the collection of types to calculate the union of all extending typespublic static Collection<ModelElementType> calculateAllBaseTypes(ModelElementType type)
public static void setNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, String newId, boolean withReferenceUpdate)
type
- the type of the model elementmodelElementInstance
- the model element instance to set the idnewId
- new identifierwithReferenceUpdate
- true to update id references in other elements, false otherwisepublic static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance)
type
- the type of the model elementmodelElementInstance
- the model element instance to set the idpublic static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate)
type
- the type of the model elementmodelElementInstance
- the model element instance to set the idwithReferenceUpdate
- true to update id references in other elements, false otherwisepublic static String getUniqueIdentifier(ModelElementType type)
Copyright © 2021. All rights reserved.