java.lang.Object
com.machinezoo.hookless.ReactiveVariable.Version
- Enclosing class:
- ReactiveVariable<T>
Reference to particular version of
ReactiveVariable
. Version of the ReactiveVariable
is already exposed via ReactiveVariable.version()
. This is just a convenience wrapper. It represents particular version of particular ReactiveVariable
.
- See Also:
-
Constructor Summary
ConstructorDescriptionVersion
(ReactiveVariable<?> variable) Creates newReactiveVariable.Version
object representing current version ofReactiveVariable
.Version
(ReactiveVariable<?> variable, long version) Creates newReactiveVariable.Version
object representing specified version of theReactiveVariable
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this version with anotherReactiveVariable.Version
.int
hashCode()
Calculates hash code of this version.long
number()
Returns the version number of the version this object represents.toString()
Returns diagnostic string representation of this version.variable()
Returns theReactiveVariable
this is a version of.
-
Constructor Details
-
Version
Creates newReactiveVariable.Version
object representing specified version of theReactiveVariable
. This constructor is useful in rare cases, for example when multiple versions have to be merged by taking minimum or maximum. ConstructorVersion(ReactiveVariable)
should be used when just capturing current version.Return values of
ReactiveVariable.version()
are always positive. Theversion
parameter of this constructor additionally allows special zero value.- Parameters:
-
variable
-ReactiveVariable
that will have its version tracked by this object -
version
- non-negative version number tracked by this object - Throws:
-
NullPointerException
- ifvariable
isnull
-
IllegalArgumentException
- ifversion
is negative
-
Version
Creates newReactiveVariable.Version
object representing current version ofReactiveVariable
. Current version is determined by callingReactiveVariable.version()
. ConstructorVersion(ReactiveVariable, long)
can be used to specify different version number.- Parameters:
-
variable
-ReactiveVariable
that will have its version tracked by this object - Throws:
-
NullPointerException
- ifvariable
isnull
-
-
Method Details
-
variable
Returns theReactiveVariable
this is a version of. This is theReactiveVariable
that was passed to the constructor.- Returns:
-
ReactiveVariable
this object is a version of
-
number
public long number()Returns the version number of the version this object represents. This is the version number that was passed to the constructor or determined at construction time by callingReactiveVariable.version()
.- Returns:
- version number of the version this object represents
- See Also:
-
equals
Compares this version with anotherReactiveVariable.Version
. Two versions are equal if they the samevariable()
andnumber()
. -
hashCode
public int hashCode()Calculates hash code of this version. Hash code incorporatesvariable()
identity and versionnumber
.- Overrides:
-
hashCode
in classObject
- Returns:
-
hash code of this
ReactiveVariable.Version
-
toString
Returns diagnostic string representation of this version.ReactiveVariable
and itsReactiveValue
is included in the result, but no reactive dependency is created by calling this method.
-