Class ClassUtility
java.lang.Object
de.iip_ecosphere.platform.support.iip_aas.ClassUtility
Utility functions for representing types in AAS. A Java type is turned into
- Submodel: types
- Submodel elements collection: Java type name, inner classes as "."
- Property:
ATTRIBUTE_PREFIX+ attribute name, value = type (for primitives or String) - Submodel elements collection:
ATTRIBUTE_PREFIX+ attribute name- Property/ReferenceElement:
NAME_ARRAY_PROPERTY_TYPE(property for primitives or String, reference element for reference types) - Property
NAME_ARRAY_PROPERTY_DIMENSIONSnumeric number of nested array dimensions
- Property/ReferenceElement:
- ReferenceElement:
ATTRIBUTE_PREFIX+ attribute name, value = ref-to collection (for reference types)
- Property:
- Submodel elements collection: Java type name, inner classes as "."
- Property: attribute1 name, value = type (for primitives, arrays and String)
- ReferenceElement: attribute1 name, value = ref-to collection (for reference types)
Skip will not be listed. So far, arrays over reference types are represented as
strings rather than references to the component type.
The implemented format is initial and will change over time (array of ref type unclear, generics).- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic de.iip_ecosphere.platform.support.aas.ReferenceAdds a type to an AAS as sub-model.private static de.iip_ecosphere.platform.support.aas.ReferenceaddType(de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder, Class<?> type) Adds a type to a sub-model.static de.iip_ecosphere.platform.support.aas.SubmodelElementaddTypeSubModelElement(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, String idShort, Class<?> type) Adds a type-representing sub-model element.static StringTurns the object into a unique id with given (optional) prefix.static StringReturns the name of the associated model element.private static voidregisterBySimpleName(Class<?> type) Registers atypeby its simple name.private static voidregisterBySimpleName(Class<?> type, Class<?> nameType) Registers atypeby the simple name ofnameType, e.g., to map wrappers to their primitive types.
-
Field Details
-
NAME_TYPE_SUBMODEL
- See Also:
-
ATTRIBUTE_PREFIX
- See Also:
-
NAME_ARRAY_PROPERTY_TYPE
- See Also:
-
NAME_ARRAY_PROPERTY_DIMENSIONS
- See Also:
-
NAME_MAPPING
-
-
Constructor Details
-
ClassUtility
public ClassUtility()
-
-
Method Details
-
registerBySimpleName
Registers atypeby its simple name.- Parameters:
type- the type
-
registerBySimpleName
Registers atypeby the simple name ofnameType, e.g., to map wrappers to their primitive types.- Parameters:
type- the typenameType- the type providing the name
-
addType
public static de.iip_ecosphere.platform.support.aas.Reference addType(de.iip_ecosphere.platform.support.aas.Aas.AasBuilder aasBuilder, Class<?> type) Adds a type to an AAS as sub-model. If the type already exists in the AAS/submodel, no new element will be created just a reference to it will be returned. [static data]- Parameters:
aasBuilder- the AAS buildertype- the type to add- Returns:
- the reference to the sub-model (null if nothing was created)
-
addType
private static de.iip_ecosphere.platform.support.aas.Reference addType(de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder, Class<?> type) Adds a type to a sub-model. [static data]- Parameters:
builder- the target sub-modeltype- the type to add- Returns:
- the reference to the type (null if nothing was created)
-
addTypeSubModelElement
public static de.iip_ecosphere.platform.support.aas.SubmodelElement addTypeSubModelElement(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, String idShort, Class<?> type) Adds a type-representing sub-model element. [static data]- Parameters:
subModelBuilder- the target sub-modelidShort- the name of the elementtype- the type to represent in the element- Returns:
- the created sub-model element
-
getName
Returns the name of the associated model element.- Parameters:
type- the type- Returns:
- the name
-
getId
Turns the object into a unique id with given (optional) prefix.- Parameters:
prefix- an optional prefix, use an empty string for none; shall end with a separator, e.g., "_"object- the object to be turned into a unique id- Returns:
- the combined id
-