Record Class GenerationId
java.lang.Object
java.lang.Record
org.opends.server.replication.common.GenerationId
- Record Components:
longValue- the generation id as a long value
The generation id used for a replication domain. It is always positive except for some very specific values like
NO_GENERATION_ID or the
SENTINEL_GENERATION_ID
used while connecting to an RS.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GenerationIdTO be used for unit testing.static final GenerationIdThis is the generation id for an empty backend.static final GenerationIdTo be used when the generation id is not set. -
Constructor Summary
ConstructorsConstructorDescriptionGenerationId(long longValue) Creates an instance of aGenerationIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisDifferent(GenerationId other) Whether this generation id is different to the provided one (and both are valid).booleanWhether this generation id isNO_GENERATION_ID) or equal to the provided one.booleanWhether this is theNO_GENERATION_IDconstant.booleanisSame(GenerationId other) Whether this generation id is the same as the provided one (and none areNO_GENERATION_ID).booleanisValid()Whether this generation id is valid, i.e.longReturns the value of thelongValuerecord component.toString()Returns a string representation of this record class.static GenerationIdvalueOf(long generationId) Returns a generation id object having the provided value.static GenerationIdvalueOf(ByteString generationId) Returns a generation id object having the provided value encoded as a ByteString.
-
Field Details
-
NO_GENERATION_ID
To be used when the generation id is not set. -
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
0in ASCII which gives48. -
DUMMY_GENERATION_ID
TO be used for unit testing.
-
-
Constructor Details
-
GenerationId
public GenerationId(long longValue) Creates an instance of aGenerationIdrecord class.- Parameters:
longValue- the value for thelongValuerecord component
-
-
Method Details
-
valueOf
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
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_IDconstant.- Returns:
- whether this is the
NO_GENERATION_IDconstant
-
isValid
public boolean isValid()Whether this generation id is valid, i.e. positive.- Returns:
- whether this generation id is valid, i.e. positive
-
isDifferent
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
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
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
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
longValue
public long longValue()Returns the value of thelongValuerecord component.- Returns:
- the value of the
longValuerecord component
-