public class ExtensionObject extends Object implements Cloneable, UaNamespaceTranslateable<ExtensionObject>
Structure which is either XML or binary encoded.UaNamespaceTranslateable.Context| Modifier and Type | Field and Description |
|---|---|
static ExtensionObject[] |
EMPTY_ARRAY |
| Constructor and Description |
|---|
ExtensionObject(ExpandedNodeId typeId)
Constructor for ExtensionObject.
|
ExtensionObject(ExpandedNodeId typeId,
byte[] object)
Deprecated.
use
ExtensionObject(ExpandedNodeId, ByteString) instead. This method will
convert the given byte[] to ByteString. |
ExtensionObject(ExpandedNodeId typeId,
ByteString object)
Constructor for ExtensionObject.
|
ExtensionObject(ExpandedNodeId typeId,
String object)
Constructor for ExtensionObject.
|
ExtensionObject(ExpandedNodeId typeId,
XmlElement object)
Constructor for ExtensionObject.
|
ExtensionObject(Structure encodeable)
ExtensionObject that encodes the value later when put into a Encoder.
|
| Modifier and Type | Method and Description |
|---|---|
static ExtensionObject |
binaryEncode(Structure encodeable,
EncoderContext ctx)
Create extension object by encoding an encodeable to a binary format using the given context.
|
static ExtensionObject |
binaryEncode(Structure encodeable,
EncoderContext ctx,
List<Locale> localeHints)
Encodes the given Structure to an ExtensionObject using the binary encoding rules.
|
ExtensionObject |
clone() |
<T extends IEncodeable> |
decode(EncoderContext ctx)
Attempts to decode the extension object using the default serializer of the stack.
|
<T extends IEncodeable> |
decode(EncoderContext ctx,
Class<T> expectedClass,
UnsignedInteger statusCodeOnFailure)
Casts the data within this object to the expected class (decoding if needed), throwing on
failure.
|
<T extends IEncodeable> |
decode(EncoderContext ctx,
NamespaceTable namespaceTable)
Decode the extension object.
|
static ExtensionObject |
encode(Structure encodeable,
QualifiedName encodingType,
EncoderContext ctx)
Create extension object by encoding an encodeable to the defined encoding using
the default serializer. |
boolean |
equals(Object obj) |
EncodeType |
getEncodeType()
Returns the type of the raw data returned by
getObject(). |
Object |
getObject()
Get the object within this
ExtensionObject. |
ExpandedNodeId |
getTypeId()
Getter for the field
typeId. |
int |
hashCode() |
boolean |
isEncoded()
Returns true, if the
getObject() is encoded value. |
static ExtensionObject |
jsonEncode(Structure encodeable,
EncoderContext ctx,
JsonEncodingMode mode)
Create an
ExtensionObject, where the given Structure is stored as JSON-encoded String. |
String |
toString() |
ExtensionObject |
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. |
static ExtensionObject |
xmlEncode(Structure encodeable,
EncoderContext ctx)
Create an
ExtensionObject, where the given Structure is stored as XML-encoded String. |
static ExtensionObject |
xmlEncode(Structure encodeable,
EncoderContext ctx,
boolean writeXmlNamespaces,
boolean indent,
int indentAmount)
Create an
ExtensionObject, where the given Structure is stored as XML-encoded String. |
public static final ExtensionObject[] EMPTY_ARRAY
public ExtensionObject(ExpandedNodeId typeId)
Constructor for ExtensionObject.
typeId - a ExpandedNodeId object.@Deprecated public ExtensionObject(ExpandedNodeId typeId, byte[] object)
ExtensionObject(ExpandedNodeId, ByteString) instead. This method will
convert the given byte[] to ByteString.Constructor for ExtensionObject.
typeId - a ExpandedNodeId object.object - an array of byte.public ExtensionObject(ExpandedNodeId typeId, ByteString object)
Constructor for ExtensionObject.
typeId - a ExpandedNodeId object.object - an array of byte.public ExtensionObject(ExpandedNodeId typeId, String object)
Constructor for ExtensionObject.
typeId - a ExpandedNodeId object.object - a json encoded objectpublic ExtensionObject(ExpandedNodeId typeId, XmlElement object)
Constructor for ExtensionObject.
typeId - a ExpandedNodeId object.object - a XmlElement object.public ExtensionObject(Structure encodeable)
encodeable - a Structure that should later be encoded.public static ExtensionObject binaryEncode(Structure encodeable, EncoderContext ctx) throws EncodingException
encodeable - encodeablectx - a EncoderContext object.EncodingException - on encoding problempublic static ExtensionObject binaryEncode(Structure encodeable, EncoderContext ctx, List<Locale> localeHints) throws EncodingException
EncodingExceptionpublic static ExtensionObject encode(Structure encodeable, QualifiedName encodingType, EncoderContext ctx) throws EncodingException
the default serializer.encodeable - the objects to encodeencodingType - the requested encoding type either QualifiedName.DEFAULT_BINARY_ENCODING or
QualifiedName.DEFAULT_XML_ENCODINGctx - a EncoderContext object.EncodingException - if the encodingType is unsupported or
the encoding failspublic static ExtensionObject jsonEncode(Structure encodeable, EncoderContext ctx, JsonEncodingMode mode) throws EncodingException
ExtensionObject, where the given Structure is stored as JSON-encoded String.EncodingExceptionpublic static ExtensionObject xmlEncode(Structure encodeable, EncoderContext ctx) throws EncodingException
ExtensionObject, where the given Structure is stored as XML-encoded String.EncodingExceptionpublic static ExtensionObject xmlEncode(Structure encodeable, EncoderContext ctx, boolean writeXmlNamespaces, boolean indent, int indentAmount) throws EncodingException
ExtensionObject, where the given Structure is stored as XML-encoded String.EncodingExceptionpublic ExtensionObject clone()
public <T extends IEncodeable> T decode(EncoderContext ctx) throws DecodingException
T - typectx - contextDecodingException - if any.public <T extends IEncodeable> T decode(EncoderContext ctx, Class<T> expectedClass, UnsignedInteger statusCodeOnFailure) throws StatusException
First the data within this object is decoded if needed by using the given context. Then the
object is cast to the given class and returned. A StatusException with the given code
is thrown if decoding or casting to the correct class fails.
T - Generics parameter for the expected class.ctx - Context for decoding.expectedClass - The expected class.statusCodeOnFailure - The error code to be thrown on failure.StatusException - If decoding or casting fails.public <T extends IEncodeable> T decode(EncoderContext ctx, NamespaceTable namespaceTable) throws DecodingException
T - typectx - contextnamespaceTable - namespace tableDecodingException - if any.public EncodeType getEncodeType()
getObject(). Returns null if this
ExtensionObject already contains a Structure.public Object getObject()
ExtensionObject. Can either be an already decoded Structure,
raw encoded format as either ByteString or XmlElement.public ExpandedNodeId getTypeId()
Getter for the field typeId.
ExpandedNodeId object.public boolean isEncoded()
getObject() is encoded value. Null is considered to be encoded
value.public ExtensionObject 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<ExtensionObject>Copyright © 2026. All rights reserved.