Package org.xrpl.xrpl4j.model.immutables
Class FluentCompareTo<T extends Comparable<? super T>>
java.lang.Object
org.xrpl.xrpl4j.model.immutables.FluentCompareTo<T>
Provides a fluent, readable alternative to
Comparable.compareTo(Object). Instead of code like
someValue.compareTo(someOtherValue) <= 0 you can write is(someValue).lessThanOrEqualTo(someOtherValue) .
Also provides stronger type safety so you can't accidentally compare apples to oranges.-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if wrapped value is between two given values (inclusive lower bound, exclusive upper bound).booleanbetweenExclusive(T startExclusive, T endExclusive) Checks if wrapped value is between 2 given values (exclusive lower bound, exclusive upper bound).booleanChecks if wrapped value is equal than the given one.getValue()Get the underlying value of thisFluentCompareTo.booleangreaterThan(T other) Checks if wrapped value is greater than than the given one.booleangreaterThanEqualTo(T other) Checks if wrapped value is greater than or equal to than the given one.static <T extends Comparable<? super T>>
FluentCompareTo<T> is(T value) Create aFluentCompareTofor the given value.static <T extends Comparable<? super T>>
FluentCompareTo<T> isNot(T value) Create aFluentCompareTofor the given value.booleanChecks if wrapped value is less than than the given one.booleanlessThanOrEqualTo(T other) Checks if wrapped value is less than or equal to than the given one.booleannotBetween(T startInclusive, T endExclusive) Checks if wrapped value is not between two given values (inclusive lower bound, exclusive upper bound).booleannotBetweenExclusive(T startExclusive, T endExclusive) Checks if wrapped value is not between two given values (exclusive lower bound, exclusive upper bound).booleannotEqualTo(T other) Checks if wrapped value is not equal than the given one.booleannotGreaterThan(T other) Checks if wrapped value is not greater than than the given one.booleannotGreaterThanEqualTo(T other) Checks if wrapped value is not greater than or equal to than the given one.booleannotLessThan(T other) Checks if wrapped value is not less than than the given one.booleannotLessThanOrEqualTo(T other) Checks if wrapped value is not less than or equal to than the given one.
-
Method Details
-
is
Create aFluentCompareTofor the given value.- Type Parameters:
T- the Java type of the wrapped value- Parameters:
value- value to wrap- Returns:
- wrapped value
-
isNot
Create aFluentCompareTofor the given value.- Type Parameters:
T- the Java type of the wrapped value- Parameters:
value- value to wrap- Returns:
- wrapped value
-
equalTo
Checks if wrapped value is equal than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is equal to given value
-
notEqualTo
Checks if wrapped value is not equal than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is not equal to given value
-
lessThan
Checks if wrapped value is less than than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is less than given value
-
notLessThan
Checks if wrapped value is not less than than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is not less than given value
-
lessThanOrEqualTo
Checks if wrapped value is less than or equal to than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is less than or equal given value
-
notLessThanOrEqualTo
Checks if wrapped value is not less than or equal to than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is not less than or equal given value
-
greaterThan
Checks if wrapped value is greater than than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is greater than given value
-
notGreaterThan
Checks if wrapped value is not greater than than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is not greater than given value
-
greaterThanEqualTo
Checks if wrapped value is greater than or equal to than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is greater than given value
-
notGreaterThanEqualTo
Checks if wrapped value is not greater than or equal to than the given one.- Parameters:
other- given value- Returns:
- true if wrapped value is not greater than given value
-
between
Checks if wrapped value is between two given values (inclusive lower bound, exclusive upper bound).- Parameters:
startInclusive- lower bound inclusive valueendExclusive- upper bound exclusive value- Returns:
- true if not between
-
notBetween
Checks if wrapped value is not between two given values (inclusive lower bound, exclusive upper bound).- Parameters:
startInclusive- lower bound inclusive valueendExclusive- upper bound exclusive value- Returns:
- true if not between
-
betweenExclusive
Checks if wrapped value is between 2 given values (exclusive lower bound, exclusive upper bound).- Parameters:
startExclusive- lower bound exclusive valueendExclusive- upper bound exclusive value- Returns:
- true if between
-
notBetweenExclusive
Checks if wrapped value is not between two given values (exclusive lower bound, exclusive upper bound).- Parameters:
startExclusive- lower bound exclusive valueendExclusive- upper bound exclusive value- Returns:
- true if not between
-
getValue
Get the underlying value of thisFluentCompareTo.- Returns:
- This
FluentCompareTo's underlying value, as typeFluentCompareTo.
-