- java.lang.Object
-
- com.machinezoo.hookless.ReactiveVariable.Version
-
- Enclosing class:
- ReactiveVariable<T>
public static class ReactiveVariable.Version extends Object
Reference to particular version ofReactiveVariable
. Version of theReactiveVariable
is already exposed viaReactiveVariable.version()
. This is just a convenience wrapper. It represents particular version of particularReactiveVariable
.- See Also:
-
ReactiveVariable.version()
-
-
Constructor Summary
Constructors Constructor Description Version(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
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.String
toString()
Returns diagnostic string representation of this version.ReactiveVariable<?>
variable()
Returns theReactiveVariable
this is a version of.
-
-
-
Constructor Detail
-
Version
public Version(ReactiveVariable<?> variable, long 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
public Version(ReactiveVariable<?> variable)
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 Detail
-
variable
public ReactiveVariable<?> 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:
-
ReactiveVariable.version()
-
equals
public boolean equals(Object obj)
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
public String 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.
-
-