CNodeId
The
Empty NodeId
There is a public EMPTY
field, which is an invalid
Constructors
The default constructor creates an invalid ID.
public CNodeId();
A
publicCNodeId (@NotNull final IId aId);
Probably the most used is the constructor, which takes a string.
publicCNodeId (@NotNull final String aId);
There is a factory method that creates a
@NotNull public staticCNodeId fromObject(@Nullable final Object aValue);
This method returns the invalid ID.
public staticCNodeId getInvalid();
There is another static method for creating a random
public staticCNodeId random();
Getter
There is a getter for the ID:
@NotNull public IId getId();
Valid and Invalid
This method returns true
if the passed
null
and not invalid.
public boolean isValid(); public static boolean isValid(@Nullable finalCNodeId aNodeId);
This method returns true
if the passed
null
or invalid.
public boolean isEmpty(); public static boolean isEmpty(@Nullable finalCNodeId aNodeId);
If a null
value is passed, this static method returns EMPTY
, otherwise the passed value.
public staticCNodeId getNonNullNodeId(@Nullable finalCNodeId aNodeId);
Comparison
This static method compares two
null
values.
public static boolean equals(@Nullable finalCNodeId aNodeId1, @Nullable finalCNodeId aNodeId2);
Comparable
interface:
public int compareTo(@NotNull finalCNodeId aOther);
Lokale NodeId
This static method returns the local
@NotNull public staticCNodeId getLocal();
There is a static method that checks if a given
public static boolean isLocal(@Nullable finalCNodeId aNodeId);
Stream I/O
A static method writes a
public static void toStream(@NotNull final DataOutput aStream, @Nullable finalCNodeId aNodeId) throws IOException;
This static method reads a
@Nullable public staticCNodeId 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
public static String valueToString(@Nullable finalCNodeId aValue);
Notes
equals()
and hashCode()
methods.