org.opcfoundation.ua.builtintypes
Class NodeId

java.lang.Object
  extended by org.opcfoundation.ua.builtintypes.NodeId
All Implemented Interfaces:
Comparable<NodeId>

public final class NodeId
extends Object
implements Comparable<NodeId>

An identifier of a node in the address space of an OPC UA server. The class Id is immutable, and hash-equals-comparable with NodeIds and ExpandedNodeIds with a NamespaceIndex and no ServerIndex.

NodeIds are equals comparable with ExpandedNodeIds that are constructed with NamespaceIndex and no ServerIndex.

See Also:
An identifier optional ServerIndex and/or explicit NamespaceUri, NamespaceTable

Field Summary
static NodeId ID
          Identifier of "NodeId" in UA AddressSpace
static NodeId NULL
           
static NodeId NULL_GUID
           
static NodeId NULL_NUMERIC
          Considered null node id
static NodeId NULL_OPAQUE
           
static NodeId NULL_STRING
           
static NodeId ZERO
           
 
Constructor Summary
NodeId(int namespaceIndex, byte[] value)
          Create new NodeId from byte[].
NodeId(int namespaceIndex, ByteString value)
          Create new Opaque NodeId from ByteString.
NodeId(int namespaceIndex, int value)
          Create new NodeId
NodeId(int namespaceIndex, String value)
          Create new NodeId
NodeId(int namespaceIndex, UnsignedInteger value)
          Create new NodeId
NodeId(int namespaceIndex, UUID value)
          Create new NodeId
 
Method Summary
 int compareTo(NodeId other)
           
static NodeId decode(String nodeIdRef)
          Deprecated. Use parseNodeId() instead (renamed for method name consistency with other similar classes)
static boolean equals(NodeId left, NodeId right)
           
 boolean equals(Object obj)
           
static NodeId get(IdType type, int namespaceIndex, Object value)
           
 IdType getIdType()
           
 int getNamespaceIndex()
           
 Object getValue()
           
 int hashCode()
           
static boolean isNull(NodeId nodeId)
          Check if nodeId is null or a NullNodeId.
 boolean isNullNodeId()
          Whether the object represents a Null NodeId.
static NodeId parseNodeId(String nodeIdRef)
          Convert String representation to NodeId.
static NodeId randomGUID(int namespaceIndex)
          Create a new random NodeId.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final NodeId ZERO

NULL_NUMERIC

public static final NodeId NULL_NUMERIC
Considered null node id


NULL_STRING

public static final NodeId NULL_STRING

NULL_GUID

public static final NodeId NULL_GUID

NULL_OPAQUE

public static final NodeId NULL_OPAQUE

NULL

public static final NodeId NULL

ID

public static final NodeId ID
Identifier of "NodeId" in UA AddressSpace

Constructor Detail

NodeId

public NodeId(int namespaceIndex,
              int value)
Create new NodeId

Parameters:
namespaceIndex - 0..65535
value - the value should be a positive integer, as it is converted to an UnsignedInteger

NodeId

public NodeId(int namespaceIndex,
              UnsignedInteger value)
Create new NodeId

Parameters:
namespaceIndex - 0..65535
value - UnsignedInteger

NodeId

public NodeId(int namespaceIndex,
              String value)
Create new NodeId

Parameters:
namespaceIndex - 0..65535
value - String or null

NodeId

public NodeId(int namespaceIndex,
              UUID value)
Create new NodeId

Parameters:
namespaceIndex - 0..65535
value - GUID value

NodeId

public NodeId(int namespaceIndex,
              byte[] value)
Create new NodeId from byte[]. It is converted to ByteString.

Parameters:
namespaceIndex - 0..65535
value - byte[] or null

NodeId

public NodeId(int namespaceIndex,
              ByteString value)
Create new Opaque NodeId from ByteString.

Parameters:
namespaceIndex - namespaceIndex 0..65535
value - ByteString, max length 4096 bytes
Method Detail

get

public static NodeId get(IdType type,
                         int namespaceIndex,
                         Object value)

isNullNodeId

public boolean isNullNodeId()
Whether the object represents a Null NodeId.

Returns:
Whether the object represents a Null NodeId.

isNull

public static boolean isNull(NodeId nodeId)
Check if nodeId is null or a NullNodeId.

Parameters:
nodeId - the nodeId
Returns:
true if (nodeId == null) || nodeId.isNullNodeId()

getIdType

public IdType getIdType()

getNamespaceIndex

public int getNamespaceIndex()

getValue

public Object getValue()
Returns:
the value, UnsignedInteger, UUID, String, ByteString, or null

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

compareTo

public int compareTo(NodeId other)
Specified by:
compareTo in interface Comparable<NodeId>

toString

public String toString()
Overrides:
toString in class Object

decode

@Deprecated
public static NodeId decode(String nodeIdRef)
                     throws IllegalArgumentException
Deprecated. Use parseNodeId() instead (renamed for method name consistency with other similar classes)

Convert String representation to NodeId. The String representation is in the following notations: ns=[id];i=[number] i=[number] ns=[id];s=[string] s=[string] ns=[id];g=[guid] g=[guid] ns=[id];b=[base64] b=[base64]

Parameters:
nodeIdRef - string
Returns:
nodeid
Throws:
IllegalArgumentException - on error

parseNodeId

public static NodeId parseNodeId(String nodeIdRef)
                          throws IllegalArgumentException
Convert String representation to NodeId. The String representation is in the following notations: ns=[id];i=[number] i=[number] ns=[id];s=[string] s=[string] ns=[id];g=[guid] g=[guid] ns=[id];b=[base64] b=[base64]

Parameters:
nodeIdRef - string format of node id
Returns:
nodeid
Throws:
IllegalArgumentException - if string notation is not correct

randomGUID

public static NodeId randomGUID(int namespaceIndex)
Create a new random NodeId. Because GUID values are always unique, this method also always returns a unique NodeId.

Parameters:
namespaceIndex - namespace index
Returns:
a new NodeId initialized with a random GUID.

equals

public static boolean equals(NodeId left,
                             NodeId right)


Copyright © 2018. All rights reserved.