java.lang.Object
org.eclipse.milo.opcua.sdk.core.typetree.TypeTree<DataType>
org.eclipse.milo.opcua.sdk.core.typetree.DataTypeTree

public class DataTypeTree extends TypeTree<DataType>
A tree-based representation of a DataType hierarchy.

Allows for convenient operations such as:

  • resolving the backing Class for a value of a given DataType
  • reducing a DataType to its inherited builtin type
  • checking if a Class would be assignable to a value of some DataType
  • retrieving the encoding ids for structured DataTypes
  • retrieving the DataTypeDefinition for structured and enumerated DataTypes
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.milo.opcua.sdk.core.typetree.TypeTree

    TypeTree.Type
  • Field Summary

    Fields inherited from class org.eclipse.milo.opcua.sdk.core.typetree.TypeTree

    tree, types
  • Constructor Summary

    Constructors
    Constructor
    Description
    DataTypeTree(org.eclipse.milo.opcua.stack.core.util.Tree<DataType> tree)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getBackingClass(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the backing Class a value of DataType dataTypeId would have.
    @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId
    getBinaryEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the NodeId of the Binary Encoding Node for the DataType identified by dataTypeId.
    org.eclipse.milo.opcua.stack.core.OpcUaDataType
    getBuiltinType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the OpcUaDataType dataTypeId inherits from, following references to the parent as necessary until a OpcUaDataType is found.
    @Nullable DataType
    getDataType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the DataType info for the DataType identified by dataTypeId, if it exists.
    @Nullable org.eclipse.milo.opcua.stack.core.types.structured.DataTypeDefinition
    getDataTypeDefinition(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the DataTypeDefinition of the DataType identified by dataTypeId.
    @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId
    getJsonEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the NodeId of the JSON Encoding Node for the DataType identified by dataTypeId.
    @Nullable org.eclipse.milo.opcua.stack.core.util.Tree<DataType>
    getTreeNode(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the underlying Tree node for the DataType identified by dataTypeId.
    @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId
    getXmlEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    Get the NodeId of the XML Encoding Node for the DataType identified by dataTypeId.
    boolean
    isAssignable(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId, Class<?> clazz)
    Check if a value of type clazz is assignable to a value of DataType dataTypeId, i.e. it is equal to or a subtype of the backing class for dataTypeId.
    boolean
    isEnumType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
     
    boolean
    isStructType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
     

    Methods inherited from class org.eclipse.milo.opcua.sdk.core.typetree.TypeTree

    containsType, getRoot, getType, isSubtypeOf, isSubtypeOf, isSubtypeOf, isSubtypeOf

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DataTypeTree

      public DataTypeTree(org.eclipse.milo.opcua.stack.core.util.Tree<DataType> tree)
  • Method Details

    • getBackingClass

      public Class<?> getBackingClass(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the backing Class a value of DataType dataTypeId would have.

      Builtin DataTypes are backed by their intrinsic backing class.

      Abstract types NodeIds0.Number, NodeIds0.Integer, and NodeIds0.UInteger are backed by Number, Integer, and UInteger respectively.

      Enumerations are backed by Integer.

      Structures are backed by ExtensionObject.

      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the backing Class a value of DataType dataTypeId would have.
      See Also:
      • OpcUaDataType
      • OpcUaDataType.getBackingClass()
    • getBuiltinType

      public org.eclipse.milo.opcua.stack.core.OpcUaDataType getBuiltinType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the OpcUaDataType dataTypeId inherits from, following references to the parent as necessary until a OpcUaDataType is found.
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the OpcUaDataType this DataType inherits from.
    • getDataType

      public @Nullable DataType getDataType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the DataType info for the DataType identified by dataTypeId, if it exists.
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the DataType info for the DataType identified by dataTypeId, if it exists.
    • getBinaryEncodingId

      public @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId getBinaryEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the NodeId of the Binary Encoding Node for the DataType identified by dataTypeId.
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the NodeId of the Binary Encoding Node, or null if none exists.
    • getXmlEncodingId

      public @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId getXmlEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the NodeId of the XML Encoding Node for the DataType identified by dataTypeId.
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the NodeId of the XML Encoding Node, or null if none exists.
    • getJsonEncodingId

      public @Nullable org.eclipse.milo.opcua.stack.core.types.builtin.NodeId getJsonEncodingId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the NodeId of the JSON Encoding Node for the DataType identified by dataTypeId.
      Parameters:
      dataTypeId - the NodeId of the DataType Node.
      Returns:
      the NodeId of the JSON Encoding Node for the DataType identified by dataTypeId.
    • getDataTypeDefinition

      public @Nullable org.eclipse.milo.opcua.stack.core.types.structured.DataTypeDefinition getDataTypeDefinition(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the DataTypeDefinition of the DataType identified by dataTypeId.

      Only Structured and Enumerated DataTypes have a DataTypeDefinition.

      Parameters:
      dataTypeId - the NodeId of the DataType Node.
      Returns:
      the DataTypeDefinition of the DataType identified by dataTypeId.
    • isAssignable

      public boolean isAssignable(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId, Class<?> clazz)
      Check if a value of type clazz is assignable to a value of DataType dataTypeId, i.e. it is equal to or a subtype of the backing class for dataTypeId.
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      clazz - the backing Class to check.
      Returns:
      true if clazz is equal to or a subtype of the backing class for dataTypeId.
    • isEnumType

      public boolean isEnumType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    • isStructType

      public boolean isStructType(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
    • getTreeNode

      public @Nullable org.eclipse.milo.opcua.stack.core.util.Tree<DataType> getTreeNode(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId dataTypeId)
      Get the underlying Tree node for the DataType identified by dataTypeId.
      Overrides:
      getTreeNode in class TypeTree<DataType>
      Parameters:
      dataTypeId - the NodeId of a DataType Node.
      Returns:
      the underlying Tree node for the DataType identified by dataTypeId.