public abstract class AbstractStructure extends Object implements Structure
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractStructure.Builder
Base builder implementation for Structures.
|
Structure.MapKind<T>UaNamespaceTranslateable.Context| Modifier and Type | Field and Description |
|---|---|
static StructureSpecification |
SPECIFICATION
A
StructureSpecification for the raw (i=22) Structure DataType. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStructure(UaDataTypeSpecification specification)
Constructor for
AbstractStructure. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Sets all fields to their default values (i.e.
|
AbstractStructure |
clone()
Clones the Structure.
|
boolean |
equals(Object obj) |
<E extends Exception> |
forEachField(CheckedBiConsumer<FieldSpecification,Object,E> operation)
Calls the given
CheckedBiConsumer for each of the Structure.specification() fields with
the value of the field. |
<E extends Exception> |
forEachField(StructureSpecification other,
CheckedBiConsumer<FieldSpecification,Object,E> operation)
Calls the given
CheckedBiConsumer for each of the given specification (see
Structure.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.
|
int |
hashCode() |
protected <T> T |
indexGet(int index)
Returns the field in the given index.
|
protected <T> void |
indexSet(T value,
int index)
Sets the given value to the given index.
|
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.
|
AbstractStructure.Builder |
toBuilder()
Returns a builder with the data of this Structure pre-set.
|
Map<String,Object> |
toFieldNamesMap()
Same as
Structure.toFieldsMap(), but uses FieldSpecification.getName() as the key. |
Map<String,Object> |
toFieldNamesMap(StructureSpecification other)
Same as
Structure.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 Structure.specification()) and values as-if Structure.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 Structure.toFieldsMap(). |
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, waitreduceFields, reduceFields, toMap, withTranslatedNamespacespublic static final StructureSpecification SPECIFICATION
StructureSpecification for the raw (i=22) Structure DataType.protected AbstractStructure(UaDataTypeSpecification specification)
AbstractStructure. The given UaDataTypeSpecification defines
the "true type" of this instance and shall be a StructureSpecification. Only SDK itself
or Codegen should be calling this.public void clear()
StructureStructure shall the same as a newly created instance where no fields have been set.public AbstractStructure clone()
CloneNotSupportedException
as all Structures must be cloneable.public <E extends Exception> void forEachField(CheckedBiConsumer<FieldSpecification,Object,E> operation) throws E extends Exception
StructureCheckedBiConsumer for each of the Structure.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 Structure.toFieldsMap(), but may perform better.forEachField in interface StructureE extends Exceptionpublic <E extends Exception> void forEachField(StructureSpecification other, CheckedBiConsumer<FieldSpecification,Object,E> operation) throws E extends Exception
StructureCheckedBiConsumer for each of the given specification (see
Structure.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
Structure.toFieldsMap(StructureSpecification), but may perform better.forEachField in interface StructureE extends Exceptionpublic Object get(FieldSpecification field)
Structureget in interface Structurefield - specification of a field, must be one of the fields in the specification given by
Structure.specification().public Object get(String fieldName)
StructureFieldSpecifications in the specification given by Structure.specification().public void set(FieldSpecification field, Object value)
StructureStructure.specification(). Setting an Optional Field to null will make it not present
for encoding. Setting a Field in an Union will unset other fields.set in interface Structurefield - specification of a field, must be one of the fields in the specification given by
Structure.specification().value - the value of the field (can be null)public void set(String fieldName, Object value)
StructureFieldSpecifications in the specification given by Structure.specification(). Setting an
Optional Field to null will make it not present for encoding. Setting a Field in an Union will
unset other fields.set in interface StructurefieldName - the field, must be the name of one of the FieldSpecifications in the
specification given by Structure.specification().value - new value for the given field, can be null.public StructureSpecification specification()
Structurespecification in interface Structurepublic AbstractStructure.Builder toBuilder()
Structure#getClass() as this one.public Map<String,Object> toFieldNamesMap()
StructureStructure.toFieldsMap(), but uses FieldSpecification.getName() as the key.toFieldNamesMap in interface Structurepublic Map<String,Object> toFieldNamesMap(StructureSpecification other)
StructureStructure.toFieldsMap(StructureSpecification), but uses
FieldSpecification.getName() as the key.toFieldNamesMap in interface Structurepublic Map<FieldSpecification,Object> toFieldsMap()
StructureStructure to a Map where keys are the FieldSpecification
(from Structure.specification()) and values as-if Structure.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.toFieldsMap in interface Structurepublic Map<FieldSpecification,Object> toFieldsMap(StructureSpecification other)
StructureStructure based on the given StructureSpecification and then split
it to it's fields similar to Structure.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
Structure.specification() or 2. a supertype of this Structure.specification() or 3. a subtype of
this Structure.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 Structure.specification().
The return is a Map where keys are the FieldSpecification (from the given
specification) and values as-if Structure.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.
toFieldsMap in interface Structureprotected <T> T indexGet(int index)
protected <T> void indexSet(T value,
int index)
Copyright © 2026. All rights reserved.