CSegmentId
A
Empty SegmentId
There is a public EMPTY
field, which is an invalid
Constructors
The default constructor creates an invalid
public CSegmentId();
A
publicCSegmentId (@NotNull final IId aId);
Probably the most used is the constructor, which takes a string.
publicCSegmentId (@NotNull final String aId);
Another constructor converts a UUID into an ID.
publicCSegmentId (@NotNull final UUID aId);
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 finalCSegmentId aSegmentId);
This method returns true
if the passed
null
or invalid.
public static boolean isEmpty(@Nullable finalCSegmentId aSegmentId);
If a null
value is passed, this static method returns EMPTY
, otherwise the passed value.
public boolean isEmpty(); public staticCSegmentId getNonNullSegmentId(@Nullable finalCSegmentId aSegmentId);
Comparison
This static method compares two
null
values.
public static boolean equals(@Nullable finalCSegmentId aSegmentId1, @Nullable finalCSegmentId aSegmentId2);
Comparable
interface:
public int compareTo(@NotNull finalCSegmentId aOther);
Lokale SegmentId
This static method returns the local
@NotNull public staticCSegmentId getLocal();
There is a static method that checks if a given
public static boolean isLocal(@Nullable finalCSegmentId aSegmentId);
Stream I/O
A static method writes a
public static void toStream(@NotNull final DataOutput aStream, @Nullable finalCSegmentId aSegmentId) throws IOException;
This static method reads a
@Nullable public staticCSegmentId 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 finalCSegmentId aValue);
Notes
equals()
and hashCode()
methods.