ExpandedNodeId { public String toParseableString() { StringBuilder sb = new StringBuilder(); if (serverIndex.intValue() != 0) { sb.append("svr=").append(serverIndex).append(";"); } if (namespaceUri != null) { sb.append("nsu=").append(namespaceUri).append(";"); } else { int namespaceIndex = getNamespaceIndex().intValue(); sb.append("ns=").append(namespaceIndex).append(";"); } switch (getType()) { case Numeric: sb.append("i=").append(getIdentifier()); break; case String: sb.append("s=").append(getIdentifier()); break; case Guid: sb.append("g=").append(getIdentifier()); break; case Opaque: ByteString bs = (ByteString) getIdentifier(); if (bs.isNull()) sb.append("b="); else sb.append("b=").append(DatatypeConverter.printBase64Binary(bs.bytes())); break; default: throw new IllegalStateException("IdType " + getType()); } return sb.toString(); } ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        UInteger identifier
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        UInteger identifier,
        UInteger serverIndex
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        String identifier
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        String identifier,
        UInteger serverIndex
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        ByteString identifier
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        ByteString identifier,
        UInteger serverIndex
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        UUID identifier
    );  ExpandedNodeId(
        UShort namespaceIndex,
        String namespaceUri,
        UUID identifier,
        UInteger serverIndex
    );  ExpandedNodeId(
        @Nonnull UShort namespaceIndex,
        @Nullable String namespaceUri,
        @Nullable Object identifier,
        @Nonnull UInteger serverIndex
    ); Object getIdentifier(); IdType getType(); UShort getNamespaceIndex(); @Nullable String getNamespaceUri(); UInteger getServerIndex(); boolean isAbsolute(); boolean isRelative(); boolean isLocal(); boolean isNull(); boolean isNotNull(); Optional<ExpandedNodeId> absolute(NamespaceTable namespaceTable); Optional<ExpandedNodeId> relative(NamespaceTable namespaceTable); ExpandedNodeId reindex(NamespaceTable namespaceTable, String namespaceUri); @Deprecated Optional<NodeId> local(NamespaceTable namespaceTable); @Deprecated NodeId localOrThrow(NamespaceTable namespaceTable); Optional<NodeId> toNodeId(NamespaceTable namespaceTable); NodeId toNodeIdOrThrow(NamespaceTable namespaceTable); @Override boolean equals(Object o); boolean equals(NodeId nodeId); boolean equals(NodeId nodeId, NamespaceTable namespaceTable); @Override int hashCode(); @Override String toString(); String toParseableString(); static ExpandedNodeId parse(String s); @Nullable static ExpandedNodeId parseOrNull(@Nonnull String s); static Optional<ExpandedNodeId> parseSafe(@Nonnull String s); static Builder newBuilder(); static final ExpandedNodeId NULL_VALUE; }
@Test public void testToParseableString() { String withoutNamespaceUri = new ExpandedNodeId(ushort(1), null, uint(0)).toParseableString(); assertEquals(withoutNamespaceUri, "ns=1;i=0"); String withNamespaceUri = new ExpandedNodeId(ushort(0), "urn:test", uint(0)).toParseableString(); assertEquals(withNamespaceUri, "nsu=urn:test;i=0"); String withServerIndex = new ExpandedNodeId(ushort(0), "urn:test", uint(0), uint(1)).toParseableString(); assertEquals(withServerIndex, "svr=1;nsu=urn:test;i=0"); }
@Test public void toParseableExplicitNamespaceZero() { ExpandedNodeId xni = new ExpandedNodeId(ushort(0), null, "test"); assertEquals("ns=0;s=test", xni.toParseableString()); }