Class Assumed
- java.lang.Object
-
- net.sourceforge.uiq3.Assumed
-
public final class Assumed extends Object
Some utility classes to check parameter
- Since:
- 1.0
- Version:
- 1.0 $Revision: 7681 $
- Author:
- "Martin Krischik" «krischik@users.sourceforge.net»
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Assumed()
Utility class, do not create
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
equal(long left, long right)
test if a string lengths is inside the range min … maxstatic void
equal(long left, long right, @NotNull String name)
test if a string lengths is inside the range min … maxstatic void
equal(@NotNull Enum<?> left, @NotNull Enum<?> right, @NotNull String name)
test if two enums are the same.static void
greaterEqual(long left, long right)
test if a string lengths is inside the range min … maxstatic void
greaterEqual(long left, long right, @NotNull String name)
test if a string lengths is inside the range min … maxstatic void
isFalse(boolean value)
test if a string lengths is inside the range min … maxstatic void
isFalse(boolean value, @NotNull String name)
test if a string lengths is inside the range min … maxstatic void
isInstance(@NotNull Object value, @NotNull Class<?> type)
test if a string lengths is inside the range min … maxstatic void
isInstance(@NotNull Object value, @NotNull Class<?> type, @NotNull String name)
test if a string lengths is inside the range min … maxstatic void
isNatural(int value)
test if a numeric value is greater or equal 0static void
isNatural(int value, @NotNull String name)
test if a numeric value is greater or equal 0static void
isNull(@Nullable Object value)
test if an instance is nullstatic void
isNull(@Nullable Object value, @NotNull String name)
test if an instance is nullstatic void
isPositive(int value)
test if a numeric value is greater or equal 1static void
isPositive(int value, @NotNull String name)
test if a numeric value is greater or equal 1static void
isTrue(boolean value)
test if a string lengths is inside the range min … maxstatic void
isTrue(boolean value, @NotNull String name)
test if a string lengths is inside the range min … maxstatic void
notEmpty(@Nullable String value)
test if a string lengths is not emptystatic void
notEmpty(@Nullable String value, @NotNull String name)
test if a string lengths is not emptystatic void
notNull(@Nullable Object value)
test if an instnce is not nullstatic void
notNull(@Nullable Object value, @NotNull String name)
test if an instnce is not nullstatic void
range(byte value, byte min, byte max)
test if a numeric value is inside the range min … maxstatic void
range(byte value, byte min, byte max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(double value, double min, double max)
test if a numeric value is inside the range min … maxstatic void
range(double value, double min, double max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(float value, float min, float max)
test if a numeric value is inside the range min … maxstatic void
range(float value, float min, float max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(int value, int min, int max)
test if a numeric value is inside the range min … maxstatic void
range(int value, int min, int max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(long value, long min, long max)
test if a numeric value is inside the range min … maxstatic void
range(long value, long min, long max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(short value, short min, short max)
test if a numeric value is inside the range min … maxstatic void
range(short value, short min, short max, @NotNull String name)
test if a numeric value is inside the range min … maxstatic void
range(@NotNull CharSequence value, int min, int max)
test if a string lenght is inside the range min … maxstatic void
range(@NotNull CharSequence value, int min, int max, @NotNull String name)
test if a string length is inside the range min … maxstatic void
range(@NotNull Object @NotNull [] value, int min, int max)
test if a string length is inside the range min … maxstatic void
range(@NotNull Object @NotNull [] value, int min, int max, @NotNull String name)
test if a string lenght is inside the range min … maxstatic void
rangeOrNull(@Nullable CharSequence value, int min, int max)
test if a string length is inside the range min … maxstatic void
rangeOrNull(@Nullable CharSequence value, int min, int max, @NotNull String name)
test if a string length is inside the range min … max
-
-
-
Method Detail
-
equal
public static void equal(long left, long right)
test if a string lengths is inside the range min … max
- Parameters:
left
- value to testright
- value to test- Throws:
IllegalStateException
- when value is outside min … max
-
equal
public static void equal(long left, long right, @NotNull @NotNull String name)
test if a string lengths is inside the range min … max
- Parameters:
left
- value to testright
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
equal
public static void equal(@NotNull @NotNull Enum<?> left, @NotNull @NotNull Enum<?> right, @NotNull @NotNull String name)
test if two enums are the same.
- Parameters:
left
- value to testright
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
greaterEqual
public static void greaterEqual(long left, long right)
test if a string lengths is inside the range min … max
- Parameters:
left
- value to testright
- value to test- Throws:
IllegalStateException
- when value is outside min … max
-
greaterEqual
public static void greaterEqual(long left, long right, @NotNull @NotNull String name)
test if a string lengths is inside the range min … max
- Parameters:
left
- value to testright
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
isFalse
@Contract("true -> fail") public static void isFalse(boolean value)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to test- Throws:
IllegalStateException
- when value is outside min … max
-
isFalse
@Contract("true, _ -> fail") public static void isFalse(boolean value, @NotNull @NotNull String name)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
isInstance
public static void isInstance(@NotNull @NotNull Object value, @NotNull @NotNull Class<?> type)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to testtype
- type to check against- Throws:
IllegalStateException
- when value is outside min … max
-
isInstance
public static void isInstance(@NotNull @NotNull Object value, @NotNull @NotNull Class<?> type, @NotNull @NotNull String name)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to testtype
- type to check againstname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
isNatural
public static void isNatural(int value)
test if a numeric value is greater or equal 0
- Parameters:
value
- value to test- Throws:
IllegalArgumentException
- when value is not not greater 0
-
isNatural
public static void isNatural(int value, @NotNull @NotNull String name)
test if a numeric value is greater or equal 0
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalArgumentException
- when value is not greater or equal 0
-
isNull
@Contract("!null -> fail") public static void isNull(@Nullable @Nullable Object value)
test if an instance is null
- Parameters:
value
- value to test- Throws:
IllegalStateException
- when the instance is null
-
isNull
@Contract("!null, _ -> fail") public static void isNull(@Nullable @Nullable Object value, @NotNull @NotNull String name)
test if an instance is null
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when the instance is null
-
isPositive
public static void isPositive(int value)
test if a numeric value is greater or equal 1
- Parameters:
value
- value to test- Throws:
IllegalArgumentException
- when value is not greater or equal 1
-
isPositive
public static void isPositive(int value, @NotNull @NotNull String name)
test if a numeric value is greater or equal 1
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalArgumentException
- when value is not greater or equal 1
-
isTrue
@Contract("false -> fail") public static void isTrue(boolean value)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to test- Throws:
IllegalStateException
- when value is outside min … max
-
isTrue
@Contract("false, _ -> fail") public static void isTrue(boolean value, @NotNull @NotNull String name)
test if a string lengths is inside the range min … max
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
notEmpty
public static void notEmpty(@Nullable @Nullable String value)
test if a string lengths is not empty
- Parameters:
value
- value to test- Throws:
IllegalStateException
- when value is outside min … max
-
notEmpty
public static void notEmpty(@Nullable @Nullable String value, @NotNull @NotNull String name)
test if a string lengths is not empty
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
notNull
@Contract("null -> fail") public static void notNull(@Nullable @Nullable Object value)
test if an instnce is not null
- Parameters:
value
- value to test- Throws:
IllegalStateException
- when the instance is null
-
notNull
@Contract("null, _ -> fail") public static void notNull(@Nullable @Nullable Object value, @NotNull @NotNull String name)
test if an instnce is not null
- Parameters:
value
- value to testname
- value name for better error message- Throws:
IllegalStateException
- when the instance is null
-
range
public static void range(byte value, byte min, byte max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(byte value, byte min, byte max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(@NotNull @NotNull CharSequence value, int min, int max)
test if a string lenght is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(@NotNull @NotNull CharSequence value, int min, int max, @NotNull @NotNull String name)
test if a string length is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(double value, double min, double max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(double value, double min, double max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(float value, float min, float max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(float value, float min, float max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(int value, int min, int max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(int value, int min, int max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(long value, long min, long max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(long value, long min, long max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(@NotNull @NotNull Object @NotNull [] value, int min, int max)
test if a string length is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(@NotNull @NotNull Object @NotNull [] value, int min, int max, @NotNull @NotNull String name)
test if a string lenght is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(short value, short min, short max)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
range
public static void range(short value, short min, short max, @NotNull @NotNull String name)
test if a numeric value is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
rangeOrNull
public static void rangeOrNull(@Nullable @Nullable CharSequence value, int min, int max)
test if a string length is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed value- Throws:
IllegalStateException
- when value is outside min … max
-
rangeOrNull
public static void rangeOrNull(@Nullable @Nullable CharSequence value, int min, int max, @NotNull @NotNull String name)
test if a string length is inside the range min … max
- Parameters:
value
- value to testmin
- minimum allowed valuemax
- maximum allowed valuename
- value name for better error message- Throws:
IllegalStateException
- when value is outside min … max
-
-