Class BaSyxElementTranslator
java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.BaSyxElementTranslator
Bridges between arbitrary BaSyx instances and instances of the IIP-Ecosphere AAS abstraction.
The BaSyx interface structure prevents handing sub-model and submodel elements collections in one
type, so we define that just for the elements. We may even avoid the type checks in here, but this
shall be ok for now.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classBaSyxElementTranslator.IterationSubmodelElementsRegistrar<T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>Internal registrar applying a function to alreadytype-matched submodel elements.(package private) static interfaceSomething that can take over/register submodel elements. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static booleancreate(de.iip_ecosphere.platform.support.aas.Submodel sub, Consumer<de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder> func, boolean propagate, String... path) Allows to create new elements denoted byfuncin the nested submodel element collection incontdenoted bypath.(package private) static List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> findInPath(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, String... path) Finds a nested element container inpathstarting atcont.(package private) static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
booleaniterate(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, de.iip_ecosphere.platform.support.aas.Submodel.IteratorFunction<T> func, Class<T> cls, String... path) Iterates over the elements of the nested submodel element collection incontdenoted bypathand appliesfuncto each element matching the type ofcls.(package private) static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
booleanmatchesType(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement elt, Class<T> cls) Returns whether the interface typeclsmatches the type of the implementing BaSyx submodel element.(package private) static voidregisterSubmodelElement(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement se, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers a single submodel element withreg.(package private) static voidregisterSubmodelElements(Collection<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.(package private) static voidregisterSubmodelElements(Map<String, org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.
-
Constructor Details
-
BaSyxElementTranslator
public BaSyxElementTranslator()
-
-
Method Details
-
registerSubmodelElements
static void registerSubmodelElements(Map<String, org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.- Parameters:
elements- the elements to be processed (as declared by BaSyx)reg- the remaining registrar
-
registerSubmodelElements
static void registerSubmodelElements(Collection<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.- Parameters:
elements- the elements to be processed (as declared by BaSyx)reg- the remaining registrar
-
registerSubmodelElement
static void registerSubmodelElement(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement se, BaSyxElementTranslator.SubmodelElementsRegistrar reg) Registers a single submodel element withreg.- Parameters:
se- the submodel elementreg- the registrar to apply for registration
-
matchesType
static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> boolean matchesType(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement elt, Class<T> cls) Returns whether the interface typeclsmatches the type of the implementing BaSyx submodel element.- Type Parameters:
T- the interface type- Parameters:
elt- the element to check for a type matchcls- the interface type- Returns:
trueif the type matches,false
-
iterate
static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> boolean iterate(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, de.iip_ecosphere.platform.support.aas.Submodel.IteratorFunction<T> func, Class<T> cls, String... path) Iterates over the elements of the nested submodel element collection incontdenoted bypathand appliesfuncto each element matching the type ofcls.- Type Parameters:
T- the element type- Parameters:
cont- the container to start atfunc- the function to apply to each matching elementcls- the class/element type used for filteringpath- the path to the submodel element collection starting at the elements ofcont- Returns:
trueiffuncwas applied at least once,falseif path did not point to a submodel element collection containing at least one element matchingcls
-
create
static boolean create(de.iip_ecosphere.platform.support.aas.Submodel sub, Consumer<de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder> func, boolean propagate, String... path) Allows to create new elements denoted byfuncin the nested submodel element collection incontdenoted bypath.- Parameters:
sub- the submodel to start atfunc- the function to apply to the appointed submodel element collectionpropagate- the change into the interface instance; if applied frequently, may imply a performance issuepath- the path to the submodel element collection starting at the elements ofcont- Returns:
trueiffuncwas applied,falseif path did not point to a submodel element collection
-
findInPath
static List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> findInPath(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, String... path) Finds a nested element container inpathstarting atcont.- Parameters:
cont- the container to start atpath- the path to follow- Returns:
- the nested container in
contspecified bypath, null for none
-