Class ModelUtil
- java.lang.Object
- 
- org.camunda.bpm.model.xml.impl.util.ModelUtil
 
- 
 public final class ModelUtil extends java.lang.ObjectSome Helpers useful when handling model elements.- Author:
- Daniel Meyer
 
- 
- 
Constructor SummaryConstructors Constructor Description ModelUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection<ModelElementType>calculateAllBaseTypes(ModelElementType type)Calculate a collection of all base types for the given typestatic java.util.Collection<ModelElementType>calculateAllExtendingTypes(Model model, java.util.Collection<ModelElementType> baseTypes)Calculate a collection of all extending types for the given base typesstatic voidensureInstanceOf(java.lang.Object instance, java.lang.Class<?> type)static intgetIndexOfElementType(ModelElementInstance modelElement, java.util.List<ModelElementType> childElementTypes)Find the index of the type of a model element in a list of element typesstatic ModelElementInstancegetModelElement(DomElement domElement, ModelInstanceImpl modelInstance)Returns theModelElementfor a DOM element.protected static ModelElementTypeImplgetModelElement(DomElement domElement, ModelInstanceImpl modelInstance, java.lang.String namespaceUri)static ModelElementInstancegetModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType)Returns theModelElementfor a DOM element.static <T extends ModelElementInstance>
 java.util.Collection<T>getModelElementCollection(java.util.Collection<DomElement> view, ModelInstanceImpl model)Get a collection of all model element instances in a viewstatic QNamegetQName(java.lang.String namespaceUri, java.lang.String localName)static java.lang.StringgetUniqueIdentifier(ModelElementType type)static voidsetGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance)Set unique identifier if the type has a String id attributestatic voidsetGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate)Set unique identifier if the type has a String id attributestatic voidsetNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, java.lang.String newId, boolean withReferenceUpdate)Set new identifier if the type has a String id attributestatic booleanvalueAsBoolean(java.lang.String rawValue)static doublevalueAsDouble(java.lang.String rawValue)static floatvalueAsFloat(java.lang.String rawValue)static intvalueAsInteger(java.lang.String rawValue)static shortvalueAsShort(java.lang.String rawValue)static java.lang.StringvalueAsString(boolean booleanValue)static java.lang.StringvalueAsString(double doubleValue)static java.lang.StringvalueAsString(float floatValue)static java.lang.StringvalueAsString(int integerValue)static java.lang.StringvalueAsString(short shortValue)
 
- 
- 
- 
Method Detail- 
getModelElementpublic static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance) Returns theModelElementfor a DOM element. If the model element does not yet exist, it is created and linked to the DOM.- Parameters:
- domElement- the child element to create a new- ModelElementfor
- Returns:
- the child model element
 
 - 
getModelElementpublic static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) Returns theModelElementfor a DOM element. If the model element does not yet exist, it is created and linked to the DOM.- Parameters:
- domElement- the child element to create a new- ModelElementfor
- modelInstance- the- ModelInstancefor which the new- ModelElementis created
- modelType- the- ModelElementTypeto create a new- ModelElementfor
- Returns:
- the child model element
 
 - 
getModelElementprotected static ModelElementTypeImpl getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, java.lang.String namespaceUri) 
 - 
getQNamepublic static QName getQName(java.lang.String namespaceUri, java.lang.String localName) 
 - 
ensureInstanceOfpublic static void ensureInstanceOf(java.lang.Object instance, java.lang.Class<?> type)
 - 
valueAsBooleanpublic static boolean valueAsBoolean(java.lang.String rawValue) 
 - 
valueAsIntegerpublic static int valueAsInteger(java.lang.String rawValue) 
 - 
valueAsFloatpublic static float valueAsFloat(java.lang.String rawValue) 
 - 
valueAsDoublepublic static double valueAsDouble(java.lang.String rawValue) 
 - 
valueAsShortpublic static short valueAsShort(java.lang.String rawValue) 
 - 
valueAsStringpublic static java.lang.String valueAsString(boolean booleanValue) 
 - 
valueAsStringpublic static java.lang.String valueAsString(int integerValue) 
 - 
valueAsStringpublic static java.lang.String valueAsString(float floatValue) 
 - 
valueAsStringpublic static java.lang.String valueAsString(double doubleValue) 
 - 
valueAsStringpublic static java.lang.String valueAsString(short shortValue) 
 - 
getModelElementCollectionpublic static <T extends ModelElementInstance> java.util.Collection<T> getModelElementCollection(java.util.Collection<DomElement> view, ModelInstanceImpl model) Get a collection of all model element instances in a view- Parameters:
- view- the collection of DOM elements to find the model element instances for
- model- the model of the elements
- Returns:
- the collection of model element instances of the view
 
 - 
getIndexOfElementTypepublic static int getIndexOfElementType(ModelElementInstance modelElement, java.util.List<ModelElementType> childElementTypes) Find the index of the type of a model element in a list of element types- Parameters:
- modelElement- the model element which type is searched for
- childElementTypes- the list to search the type
- Returns:
- the index of the model element type in the list or -1 if it is not found
 
 - 
calculateAllExtendingTypespublic static java.util.Collection<ModelElementType> calculateAllExtendingTypes(Model model, java.util.Collection<ModelElementType> baseTypes) Calculate a collection of all extending types for the given base types- Parameters:
- baseTypes- the collection of types to calculate the union of all extending types
 
 - 
calculateAllBaseTypespublic static java.util.Collection<ModelElementType> calculateAllBaseTypes(ModelElementType type) Calculate a collection of all base types for the given type
 - 
setNewIdentifierpublic static void setNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, java.lang.String newId, boolean withReferenceUpdate) Set new identifier if the type has a String id attribute- Parameters:
- type- the type of the model element
- modelElementInstance- the model element instance to set the id
- newId- new identifier
- withReferenceUpdate- true to update id references in other elements, false otherwise
 
 - 
setGeneratedUniqueIdentifierpublic static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance) Set unique identifier if the type has a String id attribute- Parameters:
- type- the type of the model element
- modelElementInstance- the model element instance to set the id
 
 - 
setGeneratedUniqueIdentifierpublic static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) Set unique identifier if the type has a String id attribute- Parameters:
- type- the type of the model element
- modelElementInstance- the model element instance to set the id
- withReferenceUpdate- true to update id references in other elements, false otherwise
 
 - 
getUniqueIdentifierpublic static java.lang.String getUniqueIdentifier(ModelElementType type) 
 
- 
 
-