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
ConstructorsConstructorDescriptionVersion(ReactiveVariable<?> variable) Creates newReactiveVariable.Versionobject representing current version ofReactiveVariable.Version(ReactiveVariable<?> variable, long version) Creates newReactiveVariable.Versionobject representing specified version of theReactiveVariable. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this version with anotherReactiveVariable.Version.inthashCode()Calculates hash code of this version.longnumber()Returns the version number of the version this object represents.toString()Returns diagnostic string representation of this version.variable()Returns theReactiveVariablethis is a version of.
-
Constructor Details
-
Version
Creates newReactiveVariable.Versionobject 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. Theversionparameter of this constructor additionally allows special zero value.- Parameters:
-
variable-ReactiveVariablethat will have its version tracked by this object -
version- non-negative version number tracked by this object - Throws:
-
NullPointerException- ifvariableisnull -
IllegalArgumentException- ifversionis negative
-
Version
Creates newReactiveVariable.Versionobject representing current version ofReactiveVariable. Current version is determined by callingReactiveVariable.version(). ConstructorVersion(ReactiveVariable, long)can be used to specify different version number.- Parameters:
-
variable-ReactiveVariablethat will have its version tracked by this object - Throws:
-
NullPointerException- ifvariableisnull
-
-
Method Details
-
variable
Returns theReactiveVariablethis is a version of. This is theReactiveVariablethat was passed to the constructor.- Returns:
-
ReactiveVariablethis 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:
-
hashCodein classObject - Returns:
-
hash code of this
ReactiveVariable.Version
-
toString
Returns diagnostic string representation of this version.ReactiveVariableand itsReactiveValueis included in the result, but no reactive dependency is created by calling this method.
-