CNodeId
The NodeId has its own class CNodeId , which is derived from the IId. It is unique in a segment and can be freely assigned.
Empty NodeId
There is a public EMPTY field, which is an invalid NodeId .
Constructors
The default constructor creates an invalid ID.
public CNodeId();
A NodeId can be made from a normal ID.
public CNodeId(@NotNull final IId aId);
Probably the most used is the constructor, which takes a string.
public CNodeId(@NotNull final String aId);
There is a factory method that creates a NodeId from an object.
@NotNull
public static CNodeId fromObject(@Nullable final Object aValue);
This method returns the invalid ID.
public static CNodeId getInvalid();
There is another static method for creating a random NodeId . The name of the random NodeId consists of an integer and is only suitable for debug purposes.
public static CNodeId random();
Getter
There is a getter for the ID:
@NotNull
public IId getId();
Valid and Invalid
This method returns true if the passed NodeId is not null and not invalid.
public boolean isValid();
public static boolean isValid(@Nullable final CNodeId aNodeId);
This method returns true if the passed NodeId is null or invalid.
public boolean isEmpty();
public static boolean isEmpty(@Nullable final CNodeId aNodeId);
If a null value is passed, this static method returns EMPTY, otherwise the
passed value.
public static CNodeId getNonNullNodeId(@Nullable final CNodeId aNodeId);
Comparison
This static method compares two NodeIds considering null values.
public static boolean equals(@Nullable final CNodeId aNodeId1,
@Nullable final CNodeId aNodeId2);
CNodeId implements the Comparable interface:
public int compareTo(@NotNull final CNodeId aOther);
Lokale NodeId
This static method returns the local NodeId that is the NodeId of the own Node.
@NotNull
public static CNodeId getLocal();
There is a static method that checks if a given NodeId belongs to its own node. A null value or an invalid value is assumed to be local.
public static boolean isLocal(@Nullable final CNodeId aNodeId);
Stream I/O
A static method writes a NodeId to a DataOutput stream.
public static void toStream(@NotNull final DataOutput aStream,
@Nullable final CNodeId aNodeId) throws IOException;
This static method reads a NodeId from a DataInput stream.
@Nullable
public static CNodeId fromStream(@NotNull final DataInput aStream) throws IOException;
String I/O
Beside the toString() method there is also a valueToString() method, which
in contrast to the first one stores a NodeId in a string in such a way that it
can be read out again.
public static String valueToString(@Nullable final CNodeId aValue);
Notes
CNodeId supports the equals() and hashCode() methods.
Related Pages
CSegmentId
The CSegmentId class defines the unique, segment-wide ID for a NYSSR node group (Segment), derived from IId, featuring utilities for creation, validation, comparison, and I/O.
The Target ID (TID)
The Target ID (TID) is the unique IId assigned to every message-receiving target within a NYSSR namespace. It enables the independent instancing of applications by being unique per namespace instance.
CNodeAddress
The CNodeAddress class defines the precise address of an NYSSR node, comprising the NodeId and SegmentId. It is the rear half of a target address and offers utilities for creation, validation, compari
The Namespace ID (NID)
The Namespace ID (NID) is the unique IId assigned to every namespace within a NYSSR node, used for identification and referencing namespaces across the system.
CIdFactory
The CIdFactory is the central class responsible for creating flexible IId objects in NYSSR. It acts as a registry for custom ID types and provides static methods for generating IDs, handling I/O opera
CRecord
The CRecord is the payload container for NYSSR messages, holding the unique message ID (IId) and the data as a map of key-value slots. It provides utilities for I/O streaming, slot management, and typ