NodeId { @Nullable public static NodeId parseOrNull(@Nonnull String s) { try { return NodeId.parse(s); } catch (UaRuntimeException t) { return null; } } NodeId(int namespaceIndex, int identifier);  NodeId(int namespaceIndex, UInteger identifier);  NodeId(int namespaceIndex, String identifier);  NodeId(int namespaceIndex, UUID identifier);  NodeId(int namespaceIndex, ByteString identifier);  NodeId(UShort namespaceIndex, UInteger identifier);  NodeId(UShort namespaceIndex, int identifier);  NodeId(UShort namespaceIndex, String identifier);  NodeId(UShort namespaceIndex, UUID identifier);  NodeId(UShort namespaceIndex, ByteString identifier);   NodeId(@Nonnull UShort namespaceIndex, @Nonnull Object identifier); UShort getNamespaceIndex(); Object getIdentifier(); IdType getType(); ExpandedNodeId expanded(); ExpandedNodeId expanded(NamespaceTable namespaceTable); boolean isNull(); boolean isNotNull(); NodeId reindex(NamespaceTable namespaceTable, String namespaceUri); NodeId withId(UInteger id); NodeId withId(String id); NodeId withId(UUID id); NodeId withId(ByteString id); NodeId withNamespaceIndex(UShort namespaceIndex); @Override boolean equals(Object o); boolean equals(ExpandedNodeId xni); boolean equals(ExpandedNodeId xni, NamespaceTable namespaceTable); @Override int hashCode(); @Override String toString(); String toParseableString(); static NodeId parse(@Nonnull String s); @Nullable static NodeId parseOrNull(@Nonnull String s); static Optional<NodeId> parseSafe(@Nonnull String s); static final NodeId NULL_NUMERIC; static final NodeId NULL_STRING; static final NodeId NULL_GUID; static final NodeId NULL_OPAQUE; static final NodeId NULL_VALUE; }
@Test public void testParseInvalid() { assertNull(NodeId.parseOrNull("")); assertNull(NodeId.parseOrNull("n")); assertNull(NodeId.parseOrNull("ns")); assertNull(NodeId.parseOrNull("ns=")); assertNull(NodeId.parseOrNull("ns=0")); assertNull(NodeId.parseOrNull("ns=0;")); assertNull(NodeId.parseOrNull("ns=0;s")); }
@Test public void testParseInt() { long[] is = new long[]{0, UByte.MAX_VALUE, UShort.MAX_VALUE, UInteger.MAX_VALUE}; for (long i : is) { assertNotNull(NodeId.parseOrNull("i=" + i)); assertNotNull(NodeId.parseOrNull("ns=0;i=" + i)); } }
@Test public void testParseString() { assertNotNull(NodeId.parseOrNull("s=")); assertNotNull(NodeId.parseOrNull("s=foo")); assertNotNull(NodeId.parseOrNull("ns=0;s=")); assertNotNull(NodeId.parseOrNull("ns=0;s=foo")); }