Class GenerationId
- java.lang.Object
-
- org.opends.server.replication.common.GenerationId
-
public final class GenerationId extends Object
The generation id used for a replication domain. It is always positive except for some very specific values likeNO_GENERATION_ID
or theSENTINEL_GENERATION_ID
used while connecting to an RS.
-
-
Field Summary
Fields Modifier and Type Field Description static GenerationId
DUMMY_GENERATION_ID
TO be used for unit testing.static GenerationId
EMPTY_BACKEND_GENERATION_ID
This is the generation id for an empty backend.static GenerationId
NO_GENERATION_ID
To be used when the generation id is not set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
boolean
isDifferent(GenerationId other)
Whether this generation id is different to the provided one (and both are valid).boolean
isEqualToOrNoGenerationId(GenerationId other)
Whether this generation id isNO_GENERATION_ID
) or equal to the provided one.boolean
isNoGenerationId()
Whether this is theNO_GENERATION_ID
constant.boolean
isSame(GenerationId other)
Whether this generation id is the same as the provided one (and none areNO_GENERATION_ID
).boolean
isValid()
Whether this generation id is valid, i.e.long
longValue()
The long value of the generation ID.String
toString()
static GenerationId
valueOf(long generationId)
Returns a generation id object having the provided value.static GenerationId
valueOf(ByteString generationId)
Returns a generation id object having the provided value encoded as a ByteString.
-
-
-
Field Detail
-
NO_GENERATION_ID
public static final GenerationId NO_GENERATION_ID
To be used when the generation id is not set.
-
EMPTY_BACKEND_GENERATION_ID
public static final GenerationId EMPTY_BACKEND_GENERATION_ID
This is the generation id for an empty backend.It corresponds to a backend entry count of zero, i.e. we encode
0
in ASCII which gives48
.
-
DUMMY_GENERATION_ID
public static final GenerationId DUMMY_GENERATION_ID
TO be used for unit testing.
-
-
Method Detail
-
valueOf
public static GenerationId valueOf(long generationId)
Returns a generation id object having the provided value.- Parameters:
generationId
- value of the generation id- Returns:
- a generation id object made having the provided value
-
valueOf
public static GenerationId valueOf(ByteString generationId)
Returns a generation id object having the provided value encoded as a ByteString.- Parameters:
generationId
- value of the generation id encoded as a ByteString- Returns:
- a generation id object made having the provided value encoded as a ByteString
-
isNoGenerationId
public boolean isNoGenerationId()
Whether this is theNO_GENERATION_ID
constant.- Returns:
- whether this is the
NO_GENERATION_ID
constant
-
longValue
public long longValue()
The long value of the generation ID.- Returns:
- long value of the generation ID
-
isValid
public boolean isValid()
Whether this generation id is valid, i.e. positive.- Returns:
- whether this generation id is valid, i.e. positive
-
isDifferent
public boolean isDifferent(GenerationId other)
Whether this generation id is different to the provided one (and both are valid).- Parameters:
other
- the generation id to compare against- Returns:
- whether this generation id is different to the provided one (and both are valid)
-
isSame
public boolean isSame(GenerationId other)
Whether this generation id is the same as the provided one (and none areNO_GENERATION_ID
).- Parameters:
other
- the generation id to compare against- Returns:
- whether this generation id is the same as the provided one (and none are
NO_GENERATION_ID
)
-
isEqualToOrNoGenerationId
public boolean isEqualToOrNoGenerationId(GenerationId other)
Whether this generation id isNO_GENERATION_ID
) or equal to the provided one.- Parameters:
other
- the generation id to compare against- Returns:
- whether this generation id is
NO_GENERATION_ID
) or equal to the provided one
-
-