com.prosysopc.ua.typedictionary
Class DynamicStructure

java.lang.Object
  extended by org.opcfoundation.ua.utils.AbstractStructure
      extended by com.prosysopc.ua.typedictionary.DynamicStructure
All Implemented Interfaces:
Cloneable, org.opcfoundation.ua.builtintypes.Structure, org.opcfoundation.ua.encoding.IEncodeable

public class DynamicStructure
extends org.opcfoundation.ua.utils.AbstractStructure

A Structure implementation that handles multiple structure types. Note that a given instance of this class is always a certain Structure type determined at construction time.


Constructor Summary
DynamicStructure(StructureSpecification specification)
          Create a new Structure based on the specification given.
 
Method Summary
 void clear()
          After calling this all fields have null value (Optional Fields are not present and Union is Null).
 DynamicStructure clone()
           
 boolean equals(Object obj)
           
 Object get(FieldSpecification field)
          Get the value of the given field.
 Object get(String fieldName)
          Get the value of the given field.
 org.opcfoundation.ua.builtintypes.ExpandedNodeId getBinaryEncodeId()
           
 List<String> getFieldNames()
          Returns the field names of the Structure as unmodifiable list.
 List<FieldSpecification> getFields()
          Returns the fields of the Structure as unmodifiable list.
 StructureSpecification getSpecification()
          Returns the specification of this structure.
 org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeId()
           
 org.opcfoundation.ua.builtintypes.ExpandedNodeId getXmlEncodeId()
           
 int hashCode()
           
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicStructure

public DynamicStructure(StructureSpecification specification)
Create a new Structure based on the specification given. NOTE! most of times you would not construct these yourself but use the return values of TypeDictionary.decode(org.opcfoundation.ua.builtintypes.ExtensionObject) instead.

Parameters:
specification - the specification, cannot be null
Method Detail

clear

public void clear()
After calling this all fields have null value (Optional Fields are not present and Union is Null).


clone

public DynamicStructure clone()
Specified by:
clone in interface org.opcfoundation.ua.builtintypes.Structure
Overrides:
clone in class org.opcfoundation.ua.utils.AbstractStructure

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

get

public Object get(FieldSpecification field)
Get the value of the given field.

Parameters:
field - the field
Returns:
the value of field (can be null)
Throws:
IllegalArgumentException - if the given field is not one of getFields()

get

public Object get(String fieldName)
Get the value of the given field. Note that the given fieldName must match one of the getFields() names.

Parameters:
fieldName - name of the field
Returns:
the value of the field (can be null)
Throws:
IllegalArgumentException - if the given field does not exist.

getBinaryEncodeId

public org.opcfoundation.ua.builtintypes.ExpandedNodeId getBinaryEncodeId()

getFieldNames

public List<String> getFieldNames()
Returns the field names of the Structure as unmodifiable list. NOTE! it is recommended to use getFields() if you need type information.


getFields

public List<FieldSpecification> getFields()
Returns the fields of the Structure as unmodifiable list.


getSpecification

public StructureSpecification getSpecification()
Returns the specification of this structure.


getTypeId

public org.opcfoundation.ua.builtintypes.ExpandedNodeId getTypeId()

getXmlEncodeId

public org.opcfoundation.ua.builtintypes.ExpandedNodeId getXmlEncodeId()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

set

public void set(FieldSpecification field,
                Object value)
Sets a new value for a field. Note that the field must be an existing one i.e. one of getFields(). Setting an Optional Field to null will make it not present for encoding. Setting a Field in an Union will unset other fields.

Parameters:
field - the field, must be one of the getFields().
value - new value for the given field, can be null.
Throws:
IllegalArgumentException - if the given field is not one of getFields()

set

public void set(String fieldName,
                Object value)
Sets a new value for a field. Note that the fieldName must be an existing one i.e. one of getFields() names. Setting an Optional Field to null will make it not present for encoding. Setting a Field in an Union will unset other fields.

Parameters:
fieldName - the field, must be one of the getFields().
value - new value for the given field, can be null.
Throws:
IllegalArgumentException - if the given field is not one of getFields()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2018. All rights reserved.