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
Modifier and TypeFieldDescriptionstatic final GenerationId
TO be used for unit testing.static final GenerationId
This is the generation id for an empty backend.static final GenerationId
To be used when the generation id is not set. -
Constructor Summary
ConstructorDescriptionGenerationId
(long longValue) Creates an instance of aGenerationId
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
isDifferent
(GenerationId other) Whether this generation id is different to the provided one (and both are valid).boolean
Whether this generation id isNO_GENERATION_ID
) or equal to the provided one.boolean
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
Returns the value of thelongValue
record component.toString()
Returns a string representation of this record class.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 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
0
in ASCII which gives48
. -
DUMMY_GENERATION_ID
TO be used for unit testing.
-
-
Constructor Details
-
GenerationId
public GenerationId(long longValue) Creates an instance of aGenerationId
record class.- Parameters:
longValue
- the value for thelongValue
record 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_ID
constant.- Returns:
- whether this is the
NO_GENERATION_ID
constant
-
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 thelongValue
record component.- Returns:
- the value of the
longValue
record component
-