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 .


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.

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();


There is a getter for the ID:

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);


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.

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.

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);


CNodeId supports the equals() and hashCode() methods. - Innovative Distributed System