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 Javalong
primitive for value classes that want to implement standard operations on that value without the pain of aggregating aLong
object.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
value
thelong
value
-
Constructor Summary
Constructors Constructor Description LongValue(long value)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(LongValue that)
Compares thisObject
to a givenObject
.boolean
equals(Object that)
Tests for equality.boolean
greaterThan(long value)
Compares thisLongValue
with a primitivelong
value.boolean
greaterThan(LongValue that)
Compares thisLongValue
with anotherLongValue
.boolean
greaterThanOrEqual(long value)
Compares thisLongValue
with a primitivelong
value.boolean
greaterThanOrEqual(LongValue that)
Compares thisLongValue
with anotherLongValue
.int
hashCode()
Returns the hash code for thisObject
.boolean
lessThan(long that)
Compares thisLongValue
with a primitivelong
value.boolean
lessThan(LongValue that)
Compares thisLongValue
with anotherLongValue
.boolean
lessThanOrEqual(long that)
Compares thisLongValue
with a primitivelong
value.boolean
lessThanOrEqual(LongValue that)
Compares thisLongValue
with 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.String
toString()
Converts thisLongValue
to aString
.
-
-
-
Field Detail
-
value
protected final long value
thelong
value
-
-
Constructor Detail
-
LongValue
public LongValue(long value)
Constructor.- Parameters:
value
- thelong
value
-
-
Method Detail
-
compareTo
public final int compareTo(LongValue that)
Compares thisObject
to a givenObject
.- Specified by:
compareTo
in interfaceComparable<LongValue>
- Parameters:
that
- theObject
to 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 thisLongValue
with a primitivelong
value.- Parameters:
value
- thelong
value to compare with- Returns:
true
if thisLongValue
is greater than the givenlong
value
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(long value)
Compares thisLongValue
with a primitivelong
value.- Parameters:
value
- thelong
value to compare with- Returns:
true
if thisLongValue
is greater than or equal to the givenlong
value
-
greaterThan
public final boolean greaterThan(LongValue that)
Compares thisLongValue
with anotherLongValue
.- Parameters:
that
- theLongValue
to compare with- Returns:
true
if thisLongValue
is greater than the givenLongValue
-
greaterThanOrEqual
public final boolean greaterThanOrEqual(LongValue that)
Compares thisLongValue
with anotherLongValue
.- Parameters:
that
- theLongValue
to compare with- Returns:
true
if thisLongValue
is 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 thisLongValue
with a primitivelong
value.- Parameters:
that
- thelong
value to compare with- Returns:
true
if thisLongValue
is less than the givenlong
value
-
lessThanOrEqual
public final boolean lessThanOrEqual(long that)
Compares thisLongValue
with a primitivelong
value.- Parameters:
that
- thelong
value to compare with- Returns:
true
if thisLongValue
is less than or equal to the givenlong
value
-
lessThan
public final boolean lessThan(LongValue that)
Compares thisLongValue
with anotherLongValue
.- Parameters:
that
- theLongValue
value to compare with- Returns:
true
if thisLongValue
is less than the givenLongValue
-
lessThanOrEqual
public final boolean lessThanOrEqual(LongValue that)
Compares thisLongValue
with anotherLongValue
.- Parameters:
that
- theLongValue
value to compare with- Returns:
true
if thisLongValue
is 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
null
if they are both null
-
-