Package org.apache.wicket.util.value
Class LongValue
- java.lang.Object
-
- org.apache.wicket.util.value.LongValue
-
- All Implemented Interfaces:
Serializable,Comparable<LongValue>
public class LongValue extends Object implements Comparable<LongValue>, Serializable
A base class based on the Javalongprimitive for value classes that want to implement standard operations on that value without the pain of aggregating aLongobject.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longvaluethelongvalue
-
Constructor Summary
Constructors Constructor Description LongValue(long value)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(LongValue that)Compares thisObjectto a givenObject.booleanequals(Object that)Tests for equality.booleangreaterThan(long value)Compares thisLongValuewith a primitivelongvalue.booleangreaterThan(LongValue that)Compares thisLongValuewith anotherLongValue.booleangreaterThanOrEqual(long value)Compares thisLongValuewith a primitivelongvalue.booleangreaterThanOrEqual(LongValue that)Compares thisLongValuewith anotherLongValue.inthashCode()Returns the hash code for thisObject.booleanlessThan(long that)Compares thisLongValuewith a primitivelongvalue.booleanlessThan(LongValue that)Compares thisLongValuewith anotherLongValue.booleanlessThanOrEqual(long that)Compares thisLongValuewith a primitivelongvalue.booleanlessThanOrEqual(LongValue that)Compares thisLongValuewith anotherLongValue.static <T extends LongValue>
Tmax(T lhs, T rhs)Returns the max of the two long values.static <T extends LongValue>
TmaxNullSafe(T lhs, T rhs)Null-safe version ofmax(T, T).static <T extends LongValue>
Tmin(T lhs, T rhs)Returns the min of the two long values.StringtoString()Converts thisLongValueto aString.
-
-
-
Field Detail
-
value
protected final long value
thelongvalue
-
-
Constructor Detail
-
LongValue
public LongValue(long value)
Constructor.- Parameters:
value- thelongvalue
-
-
Method Detail
-
compareTo
public final int compareTo(LongValue that)
Compares thisObjectto a givenObject.- Specified by:
compareToin interfaceComparable<LongValue>- Parameters:
that- theObjectto compare with- Returns:
- 0 if equal, -1 if less than the given
Object's value, or 1 if greater than givenObject's value
-
greaterThan
public final boolean greaterThan(long value)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
value- thelongvalue to compare with- Returns:
trueif thisLongValueis greater than the givenlongvalue
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(long value)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
value- thelongvalue to compare with- Returns:
trueif thisLongValueis greater than or equal to the givenlongvalue
-
greaterThan
public final boolean greaterThan(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValueto compare with- Returns:
trueif thisLongValueis greater than the givenLongValue
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValueto compare with- Returns:
trueif thisLongValueis greater than or equal to the givenLongValue
-
hashCode
public final int hashCode()
Returns the hash code for thisObject.
-
lessThan
public final boolean lessThan(long that)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
that- thelongvalue to compare with- Returns:
trueif thisLongValueis less than the givenlongvalue
-
lessThanOrEqual
public final boolean lessThanOrEqual(long that)
Compares thisLongValuewith a primitivelongvalue.- Parameters:
that- thelongvalue to compare with- Returns:
trueif thisLongValueis less than or equal to the givenlongvalue
-
lessThan
public final boolean lessThan(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValuevalue to compare with- Returns:
trueif thisLongValueis less than the givenLongValue
-
lessThanOrEqual
public final boolean lessThanOrEqual(LongValue that)
Compares thisLongValuewith anotherLongValue.- Parameters:
that- theLongValuevalue to compare with- Returns:
trueif thisLongValueis less than or equal to the givenLongValue
-
min
public static <T extends LongValue> T min(T lhs, T rhs)
Returns the min of the two long values.- Type Parameters:
T-- Parameters:
lhs-rhs-- Returns:
- min value
- Throws:
IllegalArgumentException- if either argument isnull
-
max
public static <T extends LongValue> T max(T lhs, T rhs)
Returns the max of the two long values.- Type Parameters:
T-- Parameters:
lhs-rhs-- Returns:
- max value
- Throws:
IllegalArgumentException- if either argument isnull
-
maxNullSafe
public static <T extends LongValue> T maxNullSafe(T lhs, T rhs)
Null-safe version ofmax(T, T). Nulls are considered less then any concrete value.- Type Parameters:
T-- Parameters:
lhs-rhs-- Returns:
- max of two values or
nullif they are both null
-
-