java.lang.Object
java.lang.Record
org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeId

@NullMarked public record ExpandedNodeId(ExpandedNodeId.ServerReference server, ExpandedNodeId.NamespaceReference namespace, Object identifier) extends Record
  • Field Details

  • Constructor Details

    • ExpandedNodeId

      public ExpandedNodeId(ExpandedNodeId.ServerReference server, ExpandedNodeId.NamespaceReference namespace, Object identifier)
      Creates an instance of a ExpandedNodeId record class.
      Parameters:
      server - the value for the server record component
      namespace - the value for the namespace record component
      identifier - the value for the identifier record component
  • Method Details

    • getIdentifier

      public Object getIdentifier()
    • getType

      public IdType getType()
      Get the IdType of this ExpandedNodeId's identifier.
      Returns:
      the IdType of this ExpandedNodeId's identifier.
    • getNamespaceIndex

      public @Nullable UShort getNamespaceIndex()
    • getNamespaceIndex

      public @Nullable UShort getNamespaceIndex(NamespaceTable namespaceTable)
    • getNamespaceUri

      public @Nullable String getNamespaceUri()
    • getNamespaceUri

      public @Nullable String getNamespaceUri(NamespaceTable namespaceTable)
    • getServerIndex

      public @Nullable UInteger getServerIndex()
    • getServerIndex

      public @Nullable UInteger getServerIndex(ServerTable serverTable)
    • getServerUri

      public @Nullable String getServerUri()
    • getServerUri

      public @Nullable String getServerUri(ServerTable serverTable)
    • isLocal

      public boolean isLocal()
      Check if this ExpandedNodeId is local, i.e. the server is defined in terms of a server index, and that index is 0.
      Returns:
      true if this ExpandedNodeId is local.
      See Also:
    • isLocal

      public boolean isLocal(ServerTable serverTable)
      Check if this ExpandedNodeId is local.

      If the server is defined in terms of a server index, this ExpandedNodeId is local if the index is 0.

      If the server is defined in terms of a server URI, the server table is used to determine if the URI is that of the local server (index 0).

      Parameters:
      serverTable - the ServerTable to use when checking the server URI.
      Returns:
      true if this ExpandedNodeId is local.
    • isAbsolute

      public boolean isAbsolute()
      Check if this ExpandedNodeId is absolute, i.e. it is defined in terms of a namespace URI rather than a namespace index.
      Returns:
      true if this ExpandedNodeId is absolute.
    • isRelative

      public boolean isRelative()
      Check if this ExpandedNodeId is relative, i.e. it is defined in terms of a namespace index rather than a namespace URI.
      Returns:
      true if this ExpandedNodeId is relative.
    • isOpcUaNamespace

      public boolean isOpcUaNamespace()
      Check if this ExpandedNodeId is in the OPC UA namespace, i.e. the namespace index is 0, or the namespace URI is Namespaces.OPC_UA.
      Returns:
      true if this ExpandedNodeId is in the OPC UA namespace.
    • isNull

      public boolean isNull()
      Returns:
      true if this ExpandedNodeId is null.
    • isNotNull

      public boolean isNotNull()
      Returns:
      true if this ExpandedNodeId is not null.
    • toNodeId

      public Optional<NodeId> toNodeId(NamespaceTable namespaceTable)
      Convert this ExpandedNodeId to a NodeId if it is local.

      If this ExpandedNodeId is defined in terms of a namespace URI, the namespace table is used to determine the namespace index. If the URI is not found in the namespace table, an empty Optional is returned.

      Parameters:
      namespaceTable - the NamespaceTable to use.
      Returns:
      an Optional containing the NodeId if this ExpandedNodeId is local and the namespace index can be determined.
    • toNodeIdOrThrow

      public NodeId toNodeIdOrThrow(NamespaceTable namespaceTable) throws UaException
      Like toNodeId(NamespaceTable) but throws an exception instead of returning an empty Optional.
      Parameters:
      namespaceTable - the NamespaceTable to use.
      Returns:
      the NodeId if this ExpandedNodeId is local and the namespace index can be determined.
      Throws:
      UaException - if this ExpandedNodeId is not local or the namespace index cannot be determined.
    • absolute

      public Optional<ExpandedNodeId> absolute(NamespaceTable namespaceTable)
      Convert this ExpandedNodeId to an absolute ExpandedNodeId if not already.

      An absolute ExpandedNodeId is one that defines the namespace URI rather than namespace index.

      Returns Optional.empty() if the URI is not found in the namespace table.

      Parameters:
      namespaceTable - the NamespaceTable to use when converting the index to URI.
      Returns:
      an absolute ExpandedNodeId, or this ExpandedNodeId if it's already absolute.
      See Also:
    • absolute

      public Optional<ExpandedNodeId> absolute(ServerTable serverTable, NamespaceTable namespaceTable)
    • relative

      public Optional<ExpandedNodeId> relative(NamespaceTable namespaceTable)
      Convert this ExpandedNodeId to a relative ExpandedNodeId if not already.

      A relative ExpandedNodeId is one that defines the namespace index rather than namespace URI.

      Returns Optional.empty() if the URI is not found in the namespace table.

      Parameters:
      namespaceTable - the NamespaceTable to use when converting the URI to index.
      Returns:
      a relative ExpandedNodeId, or this ExpandedNodeId if it's already relative.
      See Also:
    • reindex

      public ExpandedNodeId reindex(NamespaceTable namespaceTable, String namespaceUri)
      Re-index this ExpandedNodeId from its current namespace index to the index for namespaceUri in namespaceTable.

      If the target namespace URI is not present in the namespace table this ExpandedNodeId is returned.

      Parameters:
      namespaceTable - the NamespaceTable.
      namespaceUri - the target namespace URI.
      Returns:
      a new NodeId in the namespace index indicated by namespaceUri.
    • equalTo

      public boolean equalTo(NodeId nodeId)
      Check if this ExpandedNodeId is equal to nodeId.

      To be considered equal this ExpandedNodeId must be in serverIndex == 0, have the same namespace index as nodeId or have a namespace URI at the same index in the default namespace table, and an equal identifier.

      Parameters:
      nodeId - the NodeId to check equality against.
      Returns:
      true if this ExpandedNodeId is equal to nodeId.
    • equalTo

      public boolean equalTo(NodeId nodeId, NamespaceTable namespaceTable)
      Check if this ExpandedNodeId is equal to nodeId.

      To be considered equal this ExpandedNodeId must be in serverIndex == 0, have the same namespace index as nodeId or have a namespace URI at the same index in the default namespace table, and an equal identifier.

      Parameters:
      nodeId - the NodeId to check equality against.
      namespaceTable - the NamespaceTable used to look up the index of a namespace URI.
      Returns:
      true if this ExpandedNodeId is equal to nodeId.
    • toParseableString

      public String toParseableString()
      Convert this ExpandedNodeId to its parseable String representation.
      Returns:
      the parseable String representation of this ExpandedNodeId.
    • parse

      public static ExpandedNodeId parse(String s) throws UaRuntimeException
      Parse a String representation of an ExpandedNodeId into an ExpandedNodeId.
      Parameters:
      s - the String representation of an ExpandedNodeId.
      Returns:
      the parsed ExpandedNodeId.
      Throws:
      UaRuntimeException - if the String representation is invalid.
    • of

      public static ExpandedNodeId of(long identifier)
      Creates an ExpandedNodeId in the OPC UA namespace (index 0) with a numeric identifier.
      Parameters:
      identifier - the numeric identifier.
      Returns:
      an ExpandedNodeId with the given numeric identifier in the OPC UA namespace.
    • of

      public static ExpandedNodeId of(int namespaceIndex, long identifier)
      Creates an ExpandedNodeId with the specified namespace index and numeric identifier.
      Parameters:
      namespaceIndex - the namespace index.
      identifier - the numeric identifier.
      Returns:
      an ExpandedNodeId with the given namespace index and numeric identifier.
    • of

      public static ExpandedNodeId of(String namespaceUri, long identifier)
      Creates an ExpandedNodeId with the specified namespace URI and numeric identifier.
      Parameters:
      namespaceUri - the namespace URI.
      identifier - the numeric identifier.
      Returns:
      an ExpandedNodeId with the given namespace URI and numeric identifier.
    • of

      public static ExpandedNodeId of(UInteger identifier)
      Creates an ExpandedNodeId in the OPC UA namespace (index 0) with a UInteger identifier.
      Parameters:
      identifier - the UInteger identifier.
      Returns:
      an ExpandedNodeId with the given UInteger identifier in the OPC UA namespace.
    • of

      public static ExpandedNodeId of(String identifier)
      Creates an ExpandedNodeId in the OPC UA namespace (index 0) with a String identifier.
      Parameters:
      identifier - the String identifier.
      Returns:
      an ExpandedNodeId with the given String identifier in the OPC UA namespace.
    • of

      public static ExpandedNodeId of(UUID identifier)
      Creates an ExpandedNodeId in the OPC UA namespace (index 0) with a UUID identifier.
      Parameters:
      identifier - the UUID identifier.
      Returns:
      an ExpandedNodeId with the given UUID identifier in the OPC UA namespace.
    • of

      public static ExpandedNodeId of(ByteString identifier)
      Creates an ExpandedNodeId in the OPC UA namespace (index 0) with a ByteString identifier.
      Parameters:
      identifier - the ByteString identifier.
      Returns:
      an ExpandedNodeId with the given ByteString identifier in the OPC UA namespace.
    • of

      public static ExpandedNodeId of(UShort namespaceIndex, UInteger identifier)
      Creates an ExpandedNodeId with the specified namespace index and UInteger identifier.
      Parameters:
      namespaceIndex - the namespace index.
      identifier - the UInteger identifier.
      Returns:
      an ExpandedNodeId with the given namespace index and UInteger identifier.
    • of

      public static ExpandedNodeId of(UShort namespaceIndex, @Nullable String identifier)
      Creates an ExpandedNodeId with the specified namespace index and String identifier.
      Parameters:
      namespaceIndex - the namespace index.
      identifier - the String identifier.
      Returns:
      an ExpandedNodeId with the given namespace index and String identifier.
    • of

      public static ExpandedNodeId of(UShort namespaceIndex, UUID identifier)
      Creates an ExpandedNodeId with the specified namespace index and UUID identifier.
      Parameters:
      namespaceIndex - the namespace index.
      identifier - the UUID identifier.
      Returns:
      an ExpandedNodeId with the given namespace index and UUID identifier.
    • of

      public static ExpandedNodeId of(UShort namespaceIndex, ByteString identifier)
      Creates an ExpandedNodeId with the specified namespace index and ByteString identifier.
      Parameters:
      namespaceIndex - the namespace index.
      identifier - the ByteString identifier.
      Returns:
      an ExpandedNodeId with the given namespace index and ByteString identifier.
    • of

      public static ExpandedNodeId of(String namespaceUri, UInteger identifier)
      Creates an ExpandedNodeId with the specified namespace URI and UInteger identifier.
      Parameters:
      namespaceUri - the namespace URI.
      identifier - the UInteger identifier.
      Returns:
      an ExpandedNodeId with the given namespace URI and UInteger identifier.
    • of

      public static ExpandedNodeId of(String namespaceUri, @Nullable String identifier)
      Creates an ExpandedNodeId with the specified namespace URI and String identifier.
      Parameters:
      namespaceUri - the namespace URI.
      identifier - the String identifier.
      Returns:
      an ExpandedNodeId with the given namespace URI and String identifier.
    • of

      public static ExpandedNodeId of(String namespaceUri, UUID identifier)
      Creates an ExpandedNodeId with the specified namespace URI and UUID identifier.
      Parameters:
      namespaceUri - the namespace URI.
      identifier - the UUID identifier.
      Returns:
      an ExpandedNodeId with the given namespace URI and UUID identifier.
    • of

      public static ExpandedNodeId of(String namespaceUri, ByteString identifier)
      Creates an ExpandedNodeId with the specified namespace URI and ByteString identifier.
      Parameters:
      namespaceUri - the namespace URI.
      identifier - the ByteString identifier.
      Returns:
      an ExpandedNodeId with the given namespace URI and ByteString identifier.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • server

      Returns the value of the server record component.
      Returns:
      the value of the server record component
    • namespace

      Returns the value of the namespace record component.
      Returns:
      the value of the namespace record component
    • identifier

      public Object identifier()
      Returns the value of the identifier record component.
      Returns:
      the value of the identifier record component