public interface Structure extends IEncodeable, Cloneable, UaNamespaceTranslateable<Structure>
ServerStatusDataType or handled by DynamicStructure.
In either case, metadata regarding the Structure is held in a
StructureSpecification obtainable from an EncoderContext. In general only the SDK
or Codegen should implement this interface.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Structure.Builder
Base interface for all Builders of all Structures.
|
static class |
Structure.MapKind<T>
Marker for different kinds of maps for
toMap(MapKind). |
UaNamespaceTranslateable.Context| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Sets all fields to their default values (i.e.
|
Structure |
clone()
As every Structure is Cloneable, this method provides convinience method for calling .clone for
an unknown Structure.
|
default <E extends Exception> |
forEachField(CheckedBiConsumer<FieldSpecification,Object,E> operation)
Calls the given
CheckedBiConsumer for each of the specification() fields with
the value of the field. |
default <E extends Exception> |
forEachField(StructureSpecification other,
CheckedBiConsumer<FieldSpecification,Object,E> operation)
Calls the given
CheckedBiConsumer for each of the given specification (see
toFieldNamesMap(StructureSpecification) on the restrictions of the given
StructureSpecification) fields with the value of the field. |
Object |
get(FieldSpecification field)
Get the value of the given field.
|
Object |
get(String fieldName)
Get the value of the given field.
|
default <T,E extends Exception> |
reduceFields(StructureSpecification other,
T initialState,
CheckedTriFunction<T,FieldSpecification,Object,T,E> reducer)
Similar to
reduceFields(Object, CheckedTriFunction), but considers only fields of the
given StructureSpecification, similar to
forEachField(StructureSpecification, CheckedBiConsumer). |
default <T,E extends Exception> |
reduceFields(T initialState,
CheckedTriFunction<T,FieldSpecification,Object,T,E> reducer)
Calls the given
CheckedTriFunction in fields order. |
void |
set(FieldSpecification field,
Object value)
Sets a new value for a field.
|
void |
set(String fieldName,
Object value)
Sets a new value for a field.
|
StructureSpecification |
specification()
Returns the specification of the given Structure.
|
Structure.Builder |
toBuilder()
Returns a builder with the data of this Structure pre-set.
|
Map<String,Object> |
toFieldNamesMap()
Same as
toFieldsMap(), but uses FieldSpecification.getName() as the key. |
Map<String,Object> |
toFieldNamesMap(StructureSpecification other)
Same as
toFieldsMap(StructureSpecification), but uses
FieldSpecification.getName() as the key. |
Map<FieldSpecification,Object> |
toFieldsMap()
Splits this
Structure to a Map where keys are the FieldSpecification
(from specification()) and values as-if get(FieldSpecification) would have
been called per each field. |
Map<FieldSpecification,Object> |
toFieldsMap(StructureSpecification other)
"Casts" this
Structure based on the given StructureSpecification and then split
it to it's fields similar to toFieldsMap(). |
default <T> T |
toMap(Structure.MapKind<T> kind)
Converts this
Structure to a Map. |
default Structure |
withTranslatedNamespaces(UaNamespaceTranslateable.Context context)
Returns a deep copy of itself where all where every namespace index and uri plus server index
and uri (see
ExpandedNodeId, UaExpandedNodeId) has been swapped based on the
given UaNamespaceTranslateable.Context. |
Object get(String fieldName)
FieldSpecifications in the specification given by specification().fieldName - name of the fieldIllegalArgumentException - if the given field does not exist.void clear()
Structure shall the same as a newly created instance where no fields have been set.Structure clone()
default <E extends Exception> void forEachField(CheckedBiConsumer<FieldSpecification,Object,E> operation) throws E extends Exception
CheckedBiConsumer for each of the specification() fields with
the value of the field. Note that for Unions this will also happen for each field (but only at
most one of them has a non-null value). This gives similar results as doing
Map.forEach(BiConsumer) for toFieldsMap(), but may perform better.E extends Exceptiondefault <E extends Exception> void forEachField(StructureSpecification other, CheckedBiConsumer<FieldSpecification,Object,E> operation) throws E extends Exception
CheckedBiConsumer for each of the given specification (see
toFieldNamesMap(StructureSpecification) on the restrictions of the given
StructureSpecification) fields with the value of the field. Note that for Unions this
will also happen for each field (but only at most one of them has a non-null value). This gives
similar results as doing Map.forEach(BiConsumer) for
toFieldsMap(StructureSpecification), but may perform better.E extends ExceptionObject get(FieldSpecification field)
field - specification of a field, must be one of the fields in the specification given by
specification().IllegalArgumentException - if the given field is not one of the fields of the
specification().default <T,E extends Exception> T reduceFields(StructureSpecification other, T initialState, CheckedTriFunction<T,FieldSpecification,Object,T,E> reducer) throws E extends Exception
reduceFields(Object, CheckedTriFunction), but considers only fields of the
given StructureSpecification, similar to
forEachField(StructureSpecification, CheckedBiConsumer).E extends Exceptiondefault <T,E extends Exception> T reduceFields(T initialState, CheckedTriFunction<T,FieldSpecification,Object,T,E> reducer) throws E extends Exception
CheckedTriFunction in fields order. For the first field the first input
is the given initialState, for the second field it is the output of the first invocation and so
on. Returns the final output, or the initial state if this type contains 0 fields.E extends Exceptionvoid set(FieldSpecification field, Object value)
specification(). Setting an Optional Field to null will make it not present
for encoding. Setting a Field in an Union will unset other fields.field - specification of a field, must be one of the fields in the specification given by
specification().value - the value of the field (can be null)IllegalArgumentException - if the given field is not one of the fields of the
specification().void set(String fieldName, Object value)
FieldSpecifications in the specification given by specification(). Setting an
Optional Field to null will make it not present for encoding. Setting a Field in an Union will
unset other fields.fieldName - the field, must be the name of one of the FieldSpecifications in the
specification given by specification().value - new value for the given field, can be null.IllegalArgumentException - if the given field is not one of #getFields()StructureSpecification specification()
Structure.Builder toBuilder()
#getClass() as this one.Map<String,Object> toFieldNamesMap()
toFieldsMap(), but uses FieldSpecification.getName() as the key.Map<String,Object> toFieldNamesMap(StructureSpecification other)
toFieldsMap(StructureSpecification), but uses
FieldSpecification.getName() as the key.Map<FieldSpecification,Object> toFieldsMap()
Structure to a Map where keys are the FieldSpecification
(from specification()) and values as-if get(FieldSpecification) would have
been called per each field. The iteration order of the Map is the order of the fields. The
returned Map is unmodifiable.Map<FieldSpecification,Object> toFieldsMap(StructureSpecification other)
Structure based on the given StructureSpecification and then split
it to it's fields similar to toFieldsMap().
Throws IllegalArgumentException if the casting cannot be made, which happens if the
given StructureSpecification is not part of the inheritance hierarchy of this
Structure, i.e. the given StructureSpecification must be one of 1. the same as
specification() or 2. a supertype of this specification() or 3. a subtype of
this specification(). This method only uses
UaDataTypeSpecification.getTypeId(), StructureSpecification.getSuperTypeIds()
and FieldSpecification.getName() i.e. it is assumed that the given specification is
from the same context (client, server, pubsub) as this specification().
The return is a Map where keys are the FieldSpecification (from the given
specification) and values as-if get(FieldSpecification) would have been called per
each field (for the casted Structure). The iteration order of the Map is the order of the
fields. The returned Map is unmodifiable.
This method mainly exist for encoding purposes , where Structure fields that
are Structures themselves must be encoded as the specified type (unless
FieldSpecification.isAllowSubTypes() is true.
default <T> T toMap(Structure.MapKind<T> kind)
Structure to a Map.default Structure withTranslatedNamespaces(UaNamespaceTranslateable.Context context)
UaNamespaceTranslateableExpandedNodeId, UaExpandedNodeId) has been swapped based on the
given UaNamespaceTranslateable.Context. Returning the same object is allowed if the type is immutable and the
result is equal to this. Note that for Structure types if the
UaDataTypeSpecification translation is active the returned type can be of different
java class.withTranslatedNamespaces in interface UaNamespaceTranslateable<Structure>Copyright © 2026. All rights reserved.