クラス Preconditions
- java.lang.Object
-
- org.thinkit.common.base.precondition.Preconditions
-
public final class Preconditions extends Object
ThePreconditions
provides a way to ensure the preconditions for arguments and data at the start of the process.Each of the features provided by the
Preconditions
validates for preconditions, and if the data being validated does not meet the preconditions, it will always throw an exception corresponding to the validation process.In addition, each validation method has an option that allows you to specify an arbitrary exception object or detailed message when an exception occurs, so you can validate preconditions according to the implementation of your application. The optional exception object must inherit from
RuntimeException
.If the data passed as an argument satisfies the specified preconditions, the validation method terminates without performing any processing other than checking.
For example, here is an example of the following case where a non-empty string is required as a condition for starting a method:
Preconditions.requireNonEmpty(null); >> NullPointerException Preconditions.requireNonEmpty(""); >> PreconditionFailedException
You can also specify arbitrary exception objects and detailed messages as follows:Preconditions.requireNonEmpty("", "any exception message"); Preconditions.requireNonEmpty("", new AnyRuntimeException()); Preconditions.requireNonEmpty("", new AnyRuntimeException("any exception message"));
- 導入されたバージョン:
- 1.0.0
-
-
メソッドの概要
すべてのメソッド staticメソッド concreteメソッド 修飾子とタイプ メソッド 説明 static void
requireEndWith(String string, String suffix)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.static void
requireEndWith(String string, String suffix, RuntimeException exception)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.static void
requireEndWith(String string, String suffix, String message)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.static void
requireFalse(boolean bool)
Ensures that the boolean value given as an argument isfalse
.static void
requireFalse(boolean bool, RuntimeException exception)
Ensures that the boolean value given as an argument isfalse
.static void
requireFalse(boolean bool, String message)
Ensures that the boolean value given as an argument isfalse
.static void
requireNegative(byte number)
Ensures that the argumentnumber
is a negative byte number.static void
requireNegative(byte number, RuntimeException exception)
Ensures that the argumentnumber
is a negative byte number.static void
requireNegative(byte number, String message)
Ensures that the argumentnumber
is a negative byte number.static void
requireNegative(double number)
Ensures that the argumentnumber
is a negative double number.static void
requireNegative(double number, RuntimeException exception)
Ensures that the argumentnumber
is a negative double number.static void
requireNegative(double number, String message)
Ensures that the argumentnumber
is a negative double number.static void
requireNegative(float number)
Ensures that the argumentnumber
is a negative float number.static void
requireNegative(float number, RuntimeException exception)
Ensures that the argumentnumber
is a negative float number.static void
requireNegative(float number, String message)
Ensures that the argumentnumber
is a negative float number.static void
requireNegative(int number)
Ensures that the argumentnumber
is a negative number.static void
requireNegative(int number, RuntimeException exception)
Ensures that the argumentnumber
is a negative number.static void
requireNegative(int number, String message)
Ensures that the argumentnumber
is a negative number.static void
requireNegative(long number)
Ensures that the argumentnumber
is a negative long number.static void
requireNegative(long number, RuntimeException exception)
Ensures that the argumentnumber
is a negative long number.static void
requireNegative(long number, String message)
Ensures that the argumentnumber
is a negative long number.static void
requireNegative(short number)
Ensures that the argumentnumber
is a negative short number.static void
requireNegative(short number, RuntimeException exception)
Ensures that the argumentnumber
is a negative short number.static void
requireNegative(short number, String message)
Ensures that the argumentnumber
is a negative short number.static void
requireNonBlank(String string)
Ensures that the string of thestring
object given as an argument is not an empty string.static void
requireNonBlank(String string, RuntimeException exception)
Ensures thatstring
given as an argument is not an empty string.static void
requireNonBlank(String string, String message)
Ensures that the string of thestring
object given as an argument is not an empty string.static void
requireNonEmpty(Object[] array)
Ensures that the array passed as an argument is notnull
or an empty array.static void
requireNonEmpty(Object[] array, RuntimeException exception)
Ensures that the array passed as a number is notnull
or an empty array.static void
requireNonEmpty(Object[] array, String message)
Ensures that the array passed as an argument is notnull
or an empty array.static void
requireNonEmpty(String string)
Ensures that the reference to thestring
object specified as an argument is notnull
or the string is not an empty string.static void
requireNonEmpty(String string, RuntimeException exception)
Ensures that the value ofstring
passed as an argument is notnull
or an empty string.static void
requireNonEmpty(String string, String message)
Ensures that the reference to thestring
object specified as an argument is notnull
or the string is not an empty string.static void
requireNonEmpty(List<?> list)
Ensures thatlist
passed as an argument is notnull
or an empty list.static void
requireNonEmpty(List<?> list, RuntimeException exception)
Ensures thatlist
given as an argument is notnull
or an empty list.static void
requireNonEmpty(List<?> list, String message)
Ensures thatlist
passed as an argument is notnull
or an empty list.static void
requireNonEmpty(Map<?,?> map)
Ensures thatmap
passed as an argument is notnull
or an empty map.static void
requireNonEmpty(Map<?,?> map, RuntimeException exception)
Ensures thatmap
passed as an argument is notnull
or an empty map.static void
requireNonEmpty(Map<?,?> map, String message)
Ensures thatmap
passed as an argument is notnull
or an empty map.static void
requireNonEmpty(Set<?> set)
Ensures thatset
passed as an argument is notnull
or an empty set.static void
requireNonEmpty(Set<?> set, RuntimeException exception)
Ensures thatset
passed as an argument is notnull
or an empty set.static void
requireNonEmpty(Set<?> set, String message)
Ensures thatset
passed as an argument is notnull
or an empty set.static void
requireNonNull(Object object)
Ensures that the reference to theobject
object passed as an argument is notnull
.static void
requireNonNull(Object object, RuntimeException exception)
Ensures that the reference to theobject
object passed as an argument is notnull
.static void
requireNonNull(Object object, String message)
Ensures that the reference to theobject
object passed as an argument is notnull
.static void
requirePositive(byte number)
Ensures that thenumber
argument is a positive byte number.static void
requirePositive(byte number, RuntimeException exception)
Ensures that thenumber
argument is a positive byte number.static void
requirePositive(byte number, String message)
Ensures that thenumber
argument is a positive byte number.static void
requirePositive(double number)
Ensures that thenumber
argument is a positive double number.static void
requirePositive(double number, RuntimeException exception)
Ensures that thenumber
argument is a positive double number.static void
requirePositive(double number, String message)
Ensures that thenumber
argument is a positive double number.static void
requirePositive(float number)
Ensures that thenumber
argument is a positive float number.static void
requirePositive(float number, RuntimeException exception)
Ensures that thenumber
argument is a positive float number.static void
requirePositive(float number, String message)
Ensures that thenumber
argument is a positive float number.static void
requirePositive(int number)
Ensures that thenumber
argument is a positive number.static void
requirePositive(int number, RuntimeException exception)
Ensures that thenumber
argument is a positive number.static void
requirePositive(int number, String message)
Ensures that thenumber
argument is a positive number.static void
requirePositive(long number)
Ensures that thenumber
argument is a positive long number.static void
requirePositive(long number, RuntimeException exception)
Ensures that thenumber
argument is a positive long number.static void
requirePositive(long number, String message)
Ensures that thenumber
argument is a positive long number.static void
requirePositive(short number)
Ensures that thenumber
argument is a positive short number.static void
requirePositive(short number, RuntimeException exception)
Ensures that thenumber
argument is a positive short number.static void
requirePositive(short number, String message)
Ensures that thenumber
argument is a positive short number.static void
requireRange(byte index, byte from, byte to)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.static void
requireRange(byte index, byte from, byte to, RuntimeException exception)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.static void
requireRange(byte index, byte from, byte to, String message)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.static void
requireRange(double index, double from, double to)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.static void
requireRange(double index, double from, double to, RuntimeException exception)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.static void
requireRange(double index, double from, double to, String message)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.static void
requireRange(float index, float from, float to)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.static void
requireRange(float index, float from, float to, RuntimeException exception)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.static void
requireRange(float index, float from, float to, String message)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.static void
requireRange(int index, int from, int to)
Ensures that theindex
argument is within the range specified byfrom
toto
.static void
requireRange(int index, int from, int to, RuntimeException exception)
Ensures that theindex
argument is within the range specified byfrom
toto
.static void
requireRange(int index, int from, int to, String message)
Ensures that theindex
argument is within the range specified byfrom
toto
.static void
requireRange(long index, long from, long to)
Ensures that the longindex
argument is within the range specified byfrom
toto
.static void
requireRange(long index, long from, long to, RuntimeException exception)
Ensures that the longindex
argument is within the range specified byfrom
toto
.static void
requireRange(long index, long from, long to, String message)
Ensures that the longindex
argument is within the range specified byfrom
toto
.static void
requireRange(short index, short from, short to)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.static void
requireRange(short index, short from, short to, RuntimeException exception)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.static void
requireRange(short index, short from, short to, String message)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.static void
requireRangeFrom(byte index, byte from)
Ensures that the byteindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(byte index, byte from, RuntimeException exception)
Ensures that the byteindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(byte index, byte from, String message)
Ensures that the byteindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(double index, double from)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(double index, double from, RuntimeException exception)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(double index, double from, String message)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(float index, float from)
Ensures that the floatindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(float index, float from, RuntimeException exception)
Ensures that the floatindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(float index, float from, String message)
Ensures that the floatindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(int index, int from)
Ensures that theindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(int index, int from, RuntimeException exception)
Ensures that theindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(int index, int from, String message)
Ensures that theindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(long index, long from)
Ensures that the longindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(long index, long from, RuntimeException exception)
Ensures that the longindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(long index, long from, String message)
Ensures that the longindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(short index, short from)
Ensures that the shortindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(short index, short from, RuntimeException exception)
Ensures that the shortindex
argument is a number within the range specified byfrom
.static void
requireRangeFrom(short index, short from, String message)
Ensures that the shortindex
argument is a number within the range specified byfrom
.static void
requireRangeTo(byte index, byte to)
Ensures that the byteindex
argument is a number within the range specified byto
.static void
requireRangeTo(byte index, byte to, RuntimeException exception)
Ensures that the byteindex
argument is a number within the range specified byto
.static void
requireRangeTo(byte index, byte to, String message)
Ensures that the byteindex
argument is a number within the range specified byto
.static void
requireRangeTo(double index, double to)
Ensures that the doubleindex
argument is a number within the range specified byto
.static void
requireRangeTo(double index, double to, RuntimeException exception)
Ensures that the doubleindex
argument is a number within the range specified byto
.static void
requireRangeTo(double index, double to, String message)
Ensures that the doubleindex
argument is a number within the range specified byto
.static void
requireRangeTo(float index, float to)
Ensures that the floatindex
argument is a number within the range specified byto
.static void
requireRangeTo(float index, float to, RuntimeException exception)
Ensures that the floatindex
argument is a number within the range specified byto
.static void
requireRangeTo(float index, float to, String message)
Ensures that the floatindex
argument is a number within the range specified byto
.static void
requireRangeTo(int index, int to)
Ensures that theindex
argument is a number within the range specified byto
.static void
requireRangeTo(int index, int to, RuntimeException exception)
Ensures that theindex
argument is a number within the range specified byto
.static void
requireRangeTo(int index, int to, String message)
Ensures that theindex
argument is a number within the range specified byto
.static void
requireRangeTo(long index, long to)
Ensures that the longindex
argument is a number within the range specified byto
.static void
requireRangeTo(long index, long to, RuntimeException exception)
Ensures that the longindex
argument is a number within the range specified byto
.static void
requireRangeTo(long index, long to, String message)
Ensures that the longindex
argument is a number within the range specified byto
.static void
requireRangeTo(short index, short to)
Ensures that the shortindex
argument is a number within the range specified byto
.static void
requireRangeTo(short index, short to, RuntimeException exception)
Ensures that the shortindex
argument is a number within the range specified byto
.static void
requireRangeTo(short index, short to, String message)
Ensures that the shortindex
argument is a number within the range specified byto
.static void
requireStartWith(String string, String prefix)
Ensures that a given string begins with the prefix specified byprefix
.static void
requireStartWith(String string, String prefix, int offset)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.static void
requireStartWith(String string, String prefix, int offset, RuntimeException exception)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.static void
requireStartWith(String string, String prefix, int offset, String message)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.static void
requireStartWith(String string, String prefix, RuntimeException exception)
Ensures that a given string begins with the prefix specified byprefix
.static void
requireStartWith(String string, String prefix, String message)
Ensures that a given string begins with the prefix specified byprefix
.static void
requireTrue(boolean bool)
Ensures that the boolean value given as an argument istrue
.static void
requireTrue(boolean bool, RuntimeException exception)
Ensures that the boolean value given as an argument istrue
.static void
requireTrue(boolean bool, String message)
Ensures that the boolean value given as an argument istrue
.
-
-
-
メソッドの詳細
-
requireNonNull
public static void requireNonNull(Object object)
Ensures that the reference to theobject
object passed as an argument is notnull
.NullPointerException
is always raised at runtime if the reference to theobject
object isnull
.Use the
requireNonNull(Object, String)
method if you want to print an arbitrary detailed message when an exception is raised.If the object passed as an argument is null, NullPointerException will be thrown.
Preconditions.requireNonNull(null); >> NullPointerException
If the object passed as an argument is not null, it does nothing and ends the validation process.
Preconditions.requireNonNull("test");
- パラメータ:
object
- Object to be validated- 例外:
NullPointerException
- Ifobject
passed as an argument isnull
-
requireNonNull
public static void requireNonNull(Object object, String message)
Ensures that the reference to theobject
object passed as an argument is notnull
.If the
object
object is referenced bynull
, thenNullPointerException
is always raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.If the object passed as an argument is null, NullPointerException will be thrown. The message passed as an argument will be printed as a detailed message when an exception occurs.
Preconditions.requireNonNull(null, "any message"); >> NullPointerException
If the object passed as an argument is not null, it does nothing and ends the validation process.
Preconditions.requireNonNull("test", "any message");
- パラメータ:
object
- Object to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
NullPointerException
- Ifobject
passed as an argument isnull
-
requireNonNull
public static void requireNonNull(Object object, RuntimeException exception)
Ensures that the reference to theobject
object passed as an argument is notnull
.If the reference to a
object
object isnull
, any exception object specified as an argument will be thrown.If the object passed as an argument is null, then any exception object specified as an argument will be thrown.
Preconditions.requireNonNull(null, new AnyRuntimeException()); >> AnyRuntimeException
If the object passed as an argument is not null, it does nothing and ends the validation process.
Preconditions.requireNonNull("test", new AnyRuntimeException());
- パラメータ:
object
- Object to be validatedexception
- Any exception object that is thrown if the preconditions are not met
-
requireNonBlank
public static void requireNonBlank(String string)
Ensures that the string of thestring
object given as an argument is not an empty string.PreconditionFailedException
is always raised at runtime if the string of thestring
object is an empty string.Use the
requireNonEmpty(String)
method if a reference to astring
object specified as an argument is likely to benull
.Use the
requireNonBlank(String, String)
method if you want to print out an arbitrary detailed message when an exception is thrown. Also, to throw an arbitrary exception object when an exception is thrown, use therequireNonBlank(String, RuntimeException)
method.PreconditionFailedException will be thrown if the argument passed to string is an empty string.
Preconditions.requireNonBlank(""); >> PreconditionFailedException
If the argument string is not an empty string, the function does nothing and ends the validation process.
Preconditions.requireNonBlank("test");
- パラメータ:
string
- The string to be validated- 例外:
NullPointerException
- Ifnull
is passed as an argumentPreconditionFailedException
- If an empty string is passed as an argument
-
requireNonBlank
public static void requireNonBlank(String string, String message)
Ensures that the string of thestring
object given as an argument is not an empty string.If the string of a
string
object is an empty string,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.Use the
requireNonEmpty(String)
method if a reference to astring
object specified as an argument is likely to benull
.PreconditionFailedException will be thrown if the argument passed to string is an empty string. A message passed as an argument will be printed as a detailed message when an exception occurs.
Preconditions.requireNonBlank("", "any message"); >> PreconditionFailedException
If the argument string is not an empty string, the function does nothing and ends the validation process.
Preconditions.requireNonBlank("test", "any message");
- パラメータ:
string
- The string to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
NullPointerException
- Ifnull
is passed as an argumentPreconditionFailedException
- If an empty string is passed as an argument
-
requireNonBlank
public static void requireNonBlank(String string, RuntimeException exception)
Ensures thatstring
given as an argument is not an empty string.Throws an
exception
object if the argumentstring
is an empty string. If you do not specify any exceptions, use therequireNonBlank(String)
method.If the argument string is an empty string, any exception object specified as an argument will be thrown.
Preconditions.requireNonBlank("", new AnyRuntimeException()); >> AnyRuntimeException
If the argument string is not an empty string, the function does nothing and ends the validation process.
Preconditions.requireNonBlank("test", new AnyRuntimeException());
- パラメータ:
string
- The string to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If executed by therequireNonBlank(String)
method and thestring
passed as an argument is an empty string
-
requireNonEmpty
public static void requireNonEmpty(String string)
Ensures that the reference to thestring
object specified as an argument is notnull
or the string is not an empty string.NullPointerException
is always raised at runtime if the reference to astring
object isnull
. AndPreconditionFailedException
is always raised at runtime if the string of thestring
object is an empty string.To specify an arbitrary exception object, use the
requireNonEmpty(String, RuntimeException)
method.NullPointerException will be thrown if the argument passed to string is null.
Preconditions.requireNonEmpty(null); >> NullPointerException
PreconditionFailedException will be thrown if the argument passed to string is an empty string.
Preconditions.requireNonEmpty(""); >> PreconditionFailedException
If the argument string is not null and is not an empty string, it does nothing and ends the validation process.
Preconditions.requireNonEmpty("test");
- パラメータ:
string
- The string to be validated- 例外:
NullPointerException
- Ifnull
is passed as an argumentPreconditionFailedException
- If an empty string is passed as an argument
-
requireNonEmpty
public static void requireNonEmpty(String string, String message)
Ensures that the reference to thestring
object specified as an argument is notnull
or the string is not an empty string.If the
string
object is referenced bynull
, thenNullPointerException
is always raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.If the string of a
string
object is an empty string,PreconditionFailedException
is always raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNonEmpty(String, RuntimeException)
method.If the string argument is null, NullPointerException will be thrown. A message passed as an argument will be printed as a detailed message if an exception is raised.
Preconditions.requireNonEmpty(null, "any message"); >> NullPointerException
PreconditionFailedException will be thrown if the argument passed to string is an empty string. A message passed as an argument will be printed as a detailed message when an exception occurs.
Preconditions.requireNonEmpty("", "any message"); >> PreconditionFailedException
If the argument string is not null and is not an empty string, it does nothing and ends the validation process.
Preconditions.requireNonEmpty("test", "any message");
- パラメータ:
string
- The string to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
NullPointerException
- Ifnull
is passed as an argumentPreconditionFailedException
- If an empty string is passed as an argument
-
requireNonEmpty
public static void requireNonEmpty(String string, RuntimeException exception)
Ensures that the value ofstring
passed as an argument is notnull
or an empty string.Throws an exception if it is
null
or an empty string. If you do not specify an arbitrary exception object, use therequireNonEmpty(String)
method.NullPointerException will be thrown if the argument passed to string is null.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerException
If the argument string is an empty string, any exception object specified as an argument will be thrown.
Preconditions.requireNonEmpty("", new AnyRuntimeException()); >> AnyRuntimeException
If the argument string is not null and is not an empty string, it does nothing and ends the validation process.
Preconditions.requireNonEmpty("test", new AnyRuntimeException());
- パラメータ:
string
- The string to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
or if thestring
passed as an argument isnull
PreconditionFailedException
- Ifstring
passed as an argument is an empty string
-
requirePositive
public static void requirePositive(int number)
Ensures that thenumber
argument is a positive number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(int, RuntimeException)
method.PreconditionFailedException will be thrown if the number passed as an argument is negative.
Preconditions.requirePositive(-1); >> PreconditionFailedException
If the number passed as a number is positive, it does nothing and ends the validation process.
Preconditions.requirePositive(0);
- パラメータ:
number
- The number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(int number, String message)
Ensures that thenumber
argument is a positive number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(int, RuntimeException)
method.If the argument number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requirePositive(-1, "any message"); >> PreconditionFailedException
If the number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0, "any message");
- パラメータ:
number
- The number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(int number, RuntimeException exception)
Ensures that thenumber
argument is a positive number.If you do not specify an arbitrary exception object, use the
requirePositive(int)
method.If the number passed as an argument is negative, then any exception object specified as an argument will be thrown.
Preconditions.requirePositive(-1, new AnyRuntimeException()); >> AnyRuntimeException
If the number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0, new AnyRuntimeException());
- パラメータ:
number
- The number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specifiednumber
is negative
-
requirePositive
public static void requirePositive(long number)
Ensures that thenumber
argument is a positive long number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(long, RuntimeException)
method.PreconditionFailedException will be thrown if the long number passed as an argument is negative.
Preconditions.requirePositive(-1L); >> PreconditionFailedException
If the long number passed as a number is positive, it does nothing and ends the validation process.
Preconditions.requirePositive(0L);
- パラメータ:
number
- The long number to be validated- 例外:
PreconditionFailedException
- If the long number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(long number, String message)
Ensures that thenumber
argument is a positive long number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(long, RuntimeException)
method.If the argument long number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requirePositive(-1L, "any message"); >> PreconditionFailedException
If the long number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0L, "any message");
- パラメータ:
number
- The long number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the long number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(long number, RuntimeException exception)
Ensures that thenumber
argument is a positive long number.If you do not specify an arbitrary exception object, use the
requirePositive(long)
method.If the long number passed as an argument is negative, then any exception object specified as an argument will be thrown.
Preconditions.requirePositive(-1L, new AnyRuntimeException()); >> AnyRuntimeException
If the long number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0L, new AnyRuntimeException());
- パラメータ:
number
- The long number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specified longnumber
is negative
-
requirePositive
public static void requirePositive(short number)
Ensures that thenumber
argument is a positive short number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(short, RuntimeException)
method.PreconditionFailedException will be thrown if the short number passed as an argument is negative.
short number = -1; Preconditions.requirePositive(number); >> PreconditionFailedException
If the short number passed as a number is positive, it does nothing and ends the validation process.
short number = 0; Preconditions.requirePositive(number);
- パラメータ:
number
- The short number to be validated- 例外:
PreconditionFailedException
- If the short number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(short number, String message)
Ensures that thenumber
argument is a positive short number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(short, RuntimeException)
method.If the argument short number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
short number = -1; Preconditions.requirePositive(number, "any message"); >> PreconditionFailedException
If the short number passed as an argument is a positive number, it does nothing and exits the validation process.
short number = 0; Preconditions.requirePositive(number, "any message");
- パラメータ:
number
- The short number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the short number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(short number, RuntimeException exception)
Ensures that thenumber
argument is a positive short number.If you do not specify an arbitrary exception object, use the
requirePositive(short)
method.If the short number passed as an argument is negative, then any exception object specified as an argument will be thrown.
short number = -1; Preconditions.requirePositive(number, new AnyRuntimeException()); >> AnyRuntimeException
If the short number passed as an argument is a positive number, it does nothing and exits the validation process.
short number = 0; Preconditions.requirePositive(number, new AnyRuntimeException());
- パラメータ:
number
- The short number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specified shortnumber
is negative
-
requirePositive
public static void requirePositive(byte number)
Ensures that thenumber
argument is a positive byte number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(byte, RuntimeException)
method.PreconditionFailedException will be thrown if the byte number passed as an argument is negative.
byte number = -1; Preconditions.requirePositive(number); >> PreconditionFailedException
If the byte number passed as a number is positive, it does nothing and ends the validation process.
byte number = 0; Preconditions.requirePositive(number);
- パラメータ:
number
- The byte number to be validated- 例外:
PreconditionFailedException
- If the byte number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(byte number, String message)
Ensures that thenumber
argument is a positive byte number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(byte, RuntimeException)
method.If the argument byte number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
byte number = -1; Preconditions.requirePositive(number, "any message"); >> PreconditionFailedException
If the byte number passed as an argument is a positive number, it does nothing and exits the validation process.
byte number = 0; Preconditions.requirePositive(number, "any message");
- パラメータ:
number
- The byte number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the byte number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(byte number, RuntimeException exception)
Ensures that thenumber
argument is a positive byte number.If you do not specify an arbitrary exception object, use the
requirePositive(byte)
method.If the byte number passed as an argument is negative, then any exception object specified as an argument will be thrown.
byte number = -1; Preconditions.requirePositive(number, new AnyRuntimeException()); >> AnyRuntimeException
If the byte number passed as an argument is a positive number, it does nothing and exits the validation process.
byte number = 0; Preconditions.requirePositive(number, new AnyRuntimeException());
- パラメータ:
number
- The byte number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specified bytenumber
is negative
-
requirePositive
public static void requirePositive(float number)
Ensures that thenumber
argument is a positive float number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(float, RuntimeException)
method.PreconditionFailedException will be thrown if the float number passed as an argument is negative.
Preconditions.requirePositive(-1.0f); >> PreconditionFailedException
If the float number passed as a number is positive, it does nothing and ends the validation process.
Preconditions.requirePositive(0.0f);
- パラメータ:
number
- The float number to be validated- 例外:
PreconditionFailedException
- If the float number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(float number, String message)
Ensures that thenumber
argument is a positive float number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(float, RuntimeException)
method.If the argument float number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requirePositive(-1.0f, "any message"); >> PreconditionFailedException
If the float number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0.0f, "any message");
- パラメータ:
number
- The float number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the float number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(float number, RuntimeException exception)
Ensures that thenumber
argument is a positive float number.If you do not specify an arbitrary exception object, use the
requirePositive(float)
method.If the float number passed as an argument is negative, then any exception object specified as an argument will be thrown.
Preconditions.requirePositive(-1.0f, new AnyRuntimeException()); >> AnyRuntimeException
If the float number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0.0f, new AnyRuntimeException());
- パラメータ:
number
- The float number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specified floatnumber
is negative
-
requirePositive
public static void requirePositive(double number)
Ensures that thenumber
argument is a positive double number.If the argument
number
is negative,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requirePositive(double, RuntimeException)
method.PreconditionFailedException will be thrown if the double number passed as an argument is negative.
Preconditions.requirePositive(-1.0d); >> PreconditionFailedException
If the double number passed as a number is positive, it does nothing and ends the validation process.
Preconditions.requirePositive(0.0f);
- パラメータ:
number
- The double number to be validated- 例外:
PreconditionFailedException
- If the double number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(double number, String message)
Ensures that thenumber
argument is a positive double number.If the argument
number
is negative,PreconditionFailedException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requirePositive(double, RuntimeException)
method.If the argument double number is negative PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requirePositive(-1.0d, "any message"); >> PreconditionFailedException
If the double number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0.0d, "any message");
- パラメータ:
number
- The double number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the double number ofnumber
specified as an argument is a negative number
-
requirePositive
public static void requirePositive(double number, RuntimeException exception)
Ensures that thenumber
argument is a positive double number.If you do not specify an arbitrary exception object, use the
requirePositive(double)
method.If the double number passed as an argument is negative, then any exception object specified as an argument will be thrown.
Preconditions.requirePositive(-1.0d, new AnyRuntimeException()); >> AnyRuntimeException
If the double number passed as an argument is a positive number, it does nothing and exits the validation process.
Preconditions.requirePositive(0.0d, new AnyRuntimeException());
- パラメータ:
number
- The double number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the specified doublenumber
is negative
-
requireNegative
public static void requireNegative(int number)
Ensures that the argumentnumber
is a negative number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(int, RuntimeException)
method.PreconditionFailedException will be thrown if the number passed as an argument is positive.
Preconditions.requireNegative(0); >> PreconditionFailedException
If number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1);
- パラメータ:
number
- The number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive number
-
requireNegative
public static void requireNegative(int number, String message)
Ensures that the argumentnumber
is a negative number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(int, RuntimeException)
method.If the number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requireNegative(0, "any message"); >> PreconditionFailedException
If number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1, "any message");
- パラメータ:
number
- The number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive number
-
requireNegative
public static void requireNegative(int number, RuntimeException exception)
Ensures that the argumentnumber
is a negative number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(int)
method.If the number passed as an argument is positive, any exception object specified as an argument will be thrown.
Preconditions.requireNegative(0, new AnyRuntimeException()); >> AnyRuntimeException
If number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1, new AnyRuntimeException());
- パラメータ:
number
- The number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive number
-
requireNegative
public static void requireNegative(long number)
Ensures that the argumentnumber
is a negative long number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(long, RuntimeException)
method.PreconditionFailedException will be thrown if the long number passed as an argument is positive.
Preconditions.requireNegative(0L); >> PreconditionFailedException
If the long number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1L);
- パラメータ:
number
- The long number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive long number
-
requireNegative
public static void requireNegative(long number, String message)
Ensures that the argumentnumber
is a negative long number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(long, RuntimeException)
method.If the long number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requireNegative(0L, "any message"); >> PreconditionFailedException
If the long number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1L, "any message");
- パラメータ:
number
- The long number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive long number
-
requireNegative
public static void requireNegative(long number, RuntimeException exception)
Ensures that the argumentnumber
is a negative long number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(long)
method.If the long number passed as an argument is positive, any exception object specified as an argument will be thrown.
Preconditions.requireNegative(0L, new AnyRuntimeException()); >> AnyRuntimeException
If the long number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1L, new AnyRuntimeException());
- パラメータ:
number
- The long number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive long number
-
requireNegative
public static void requireNegative(short number)
Ensures that the argumentnumber
is a negative short number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(short, RuntimeException)
method.PreconditionFailedException will be thrown if the short number passed as an argument is positive.
short number = 0; Preconditions.requireNegative(number); >> PreconditionFailedException
If the short number passed as an argument is a negative number, it does nothing and ends the validation process.
short number = -1; Preconditions.requireNegative(number);
- パラメータ:
number
- The short number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive short number
-
requireNegative
public static void requireNegative(short number, String message)
Ensures that the argumentnumber
is a negative short number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(short, RuntimeException)
method.If the short number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
short number = -1; Preconditions.requireNegative(number, "any message"); >> PreconditionFailedException
If the short number passed as an argument is a negative number, it does nothing and ends the validation process.
short number = -1; Preconditions.requireNegative(number, "any message");
- パラメータ:
number
- The short number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive short number
-
requireNegative
public static void requireNegative(short number, RuntimeException exception)
Ensures that the argumentnumber
is a negative short number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(short)
method.If the short number passed as an argument is positive, any exception object specified as an argument will be thrown.
short number = 0; Preconditions.requireNegative(number, new AnyRuntimeException()); >> AnyRuntimeException
If the short number passed as an argument is a negative number, it does nothing and ends the validation process.
short number = -1; Preconditions.requireNegative(number, new AnyRuntimeException());
- パラメータ:
number
- The short number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive short number
-
requireNegative
public static void requireNegative(byte number)
Ensures that the argumentnumber
is a negative byte number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(byte, RuntimeException)
method.PreconditionFailedException will be thrown if the byte number passed as an argument is positive.
byte number = 0; Preconditions.requireNegative(number); >> PreconditionFailedException
If the byte number passed as an argument is a negative number, it does nothing and ends the validation process.
byte number = -1; Preconditions.requireNegative(number);
- パラメータ:
number
- The byte number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive byte number
-
requireNegative
public static void requireNegative(byte number, String message)
Ensures that the argumentnumber
is a negative byte number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(byte, RuntimeException)
method.If the byte number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
byte number = -1; Preconditions.requireNegative(number, "any message"); >> PreconditionFailedException
If the byte number passed as an argument is a negative number, it does nothing and ends the validation process.
byte number = -1; Preconditions.requireNegative(number, "any message");
- パラメータ:
number
- The byte number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive byte number
-
requireNegative
public static void requireNegative(byte number, RuntimeException exception)
Ensures that the argumentnumber
is a negative byte number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(byte)
method.If the byte number passed as an argument is positive, any exception object specified as an argument will be thrown.
byte number = 0; Preconditions.requireNegative(number, new AnyRuntimeException()); >> AnyRuntimeException
If the byte number passed as an argument is a negative number, it does nothing and ends the validation process.
byte number = -1; Preconditions.requireNegative(number, new AnyRuntimeException());
- パラメータ:
number
- The byte number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive byte number
-
requireNegative
public static void requireNegative(float number)
Ensures that the argumentnumber
is a negative float number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(float, RuntimeException)
method.PreconditionFailedException will be thrown if the float number passed as an argument is positive.
Preconditions.requireNegative(0.0f); >> PreconditionFailedException
If the float number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0f);
- パラメータ:
number
- The float number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive float number
-
requireNegative
public static void requireNegative(float number, String message)
Ensures that the argumentnumber
is a negative float number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(float, RuntimeException)
method.If the float number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requireNegative(0.0f, "any message"); >> PreconditionFailedException
If the float number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0f, "any message");
- パラメータ:
number
- The float number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive float number
-
requireNegative
public static void requireNegative(float number, RuntimeException exception)
Ensures that the argumentnumber
is a negative float number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(float)
method.If the float number passed as an argument is positive, any exception object specified as an argument will be thrown.
Preconditions.requireNegative(0.0f, new AnyRuntimeException()); >> AnyRuntimeException
If the float number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0f, new AnyRuntimeException());
- パラメータ:
number
- The float number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive float number
-
requireNegative
public static void requireNegative(double number)
Ensures that the argumentnumber
is a negative double number.If the argument
number
is positive,PreconditionFailedException
is always raised at runtime.To specify an arbitrary exception object, use the
requireNegative(double, RuntimeException)
method.PreconditionFailedException will be thrown if the double number passed as an argument is positive.
Preconditions.requireNegative(0.0d); >> PreconditionFailedException
If the double number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0d);
- パラメータ:
number
- The double number to be validated- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive double number
-
requireNegative
public static void requireNegative(double number, String message)
Ensures that the argumentnumber
is a negative double number.If the argument
number
is a positive number,PreconditionFailedException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNegative(double, RuntimeException)
method.If the double number argument is positive, PreconditionFailedException will be thrown. The message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requireNegative(0.0d, "any message"); >> PreconditionFailedException
If the double number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0d, "any message");
- パラメータ:
number
- The double number to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the number ofnumber
specified as an argument is a positive double number
-
requireNegative
public static void requireNegative(double number, RuntimeException exception)
Ensures that the argumentnumber
is a negative double number.If
number
is a positive number, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireNegative(double)
method.If the double number passed as an argument is positive, any exception object specified as an argument will be thrown.
Preconditions.requireNegative(0.0d, new AnyRuntimeException()); >> AnyRuntimeException
If the double number passed as an argument is a negative number, it does nothing and ends the validation process.
Preconditions.requireNegative(-1.0d, new AnyRuntimeException());
- パラメータ:
number
- The double number to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
PreconditionFailedException
- If the value of thenumber
passed as an argument is a positive double number
-
requireRangeFrom
public static void requireRangeFrom(int index, int from)
Ensures that theindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(int, int, RuntimeException)
method.If the index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeFrom(10, 9); >> IndexOutOfBoundsException
If the index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9, 10);
- パラメータ:
index
- The index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(int index, int from, String message)
Ensures that theindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(int, int, RuntimeException)
method.If the index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeFrom(10, 9, "any message"); >> IndexOutOfBoundsException
If the index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9, 10, "any message");
- パラメータ:
index
- The index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argumentindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(int index, int from, RuntimeException exception)
Ensures that theindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(int, int)
method.If the index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
Preconditions.requireRangeFrom(10, 9, new AnyRuntimeException()); >> AnyRuntimeException
If the index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9, 10, new AnyRuntimeException());
- パラメータ:
index
- The index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from)
Ensures that the longindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(long, long, RuntimeException)
method.If the long index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeFrom(10L, 9L); >> IndexOutOfBoundsException
If the long index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9L, 10L);
- パラメータ:
index
- The long index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the long number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from, String message)
Ensures that the longindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(long, long, RuntimeException)
method.If the long index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeFrom(10L, 9L, "any message"); >> IndexOutOfBoundsException
If the long index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9L, 10L, "any message");
- パラメータ:
index
- The long index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument longindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from, RuntimeException exception)
Ensures that the longindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(long, long)
method.If the long index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
Preconditions.requireRangeFrom(10L, 9L, new AnyRuntimeException()); >> AnyRuntimeException
If the long index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9L, 10L, new AnyRuntimeException());
- パラメータ:
index
- The long index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the long number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from)
Ensures that the shortindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(short, short, RuntimeException)
method.If the short index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
short index = 10; short from = 9; Preconditions.requireRangeFrom(index, from); >> IndexOutOfBoundsException
If the short index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
short index = 9; short from = 10; Preconditions.requireRangeFrom(index, from);
- パラメータ:
index
- The short index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the short number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from, String message)
Ensures that the shortindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(short, short, RuntimeException)
method.If the short index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
short index = 10; short from = 9; Preconditions.requireRangeFrom(index, from, "any message"); >> IndexOutOfBoundsException
If the short index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
short index = 9; short index = 10; Preconditions.requireRangeFrom(index, from, "any message");
- パラメータ:
index
- The short index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument shortindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from, RuntimeException exception)
Ensures that the shortindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(short, short)
method.If the short index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
short index = 10; short from = 9; Preconditions.requireRangeFrom(index, from, new AnyRuntimeException()); >> AnyRuntimeException
If the short index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
short index = 9; short from = 10; Preconditions.requireRangeFrom(index, number, new AnyRuntimeException());
- パラメータ:
index
- The short index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the short number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from)
Ensures that the byteindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(byte, byte, RuntimeException)
method.If the byte index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
byte index = 10; byte from = 9; Preconditions.requireRangeFrom(index, from); >> IndexOutOfBoundsException
If the byte index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
byte index = 9; byte from = 10; Preconditions.requireRangeFrom(index, from);
- パラメータ:
index
- The byte index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the byte number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from, String message)
Ensures that the byteindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(byte, byte, RuntimeException)
method.If the byte index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
byte index = 10; byte from = 9; Preconditions.requireRangeFrom(index, from, "any message"); >> IndexOutOfBoundsException
If the byte index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
byte index = 9; byte index = 10; Preconditions.requireRangeFrom(index, from, "any message");
- パラメータ:
index
- The byte index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument byteindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from, RuntimeException exception)
Ensures that the byteindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(byte, byte)
method.If the byte index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
byte index = 10; byte from = 9; Preconditions.requireRangeFrom(index, from, new AnyRuntimeException()); >> AnyRuntimeException
If the byte index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
byte index = 9; byte from = 10; Preconditions.requireRangeFrom(index, number, new AnyRuntimeException());
- パラメータ:
index
- The byte index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the byte number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from)
Ensures that the floatindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(float, float, RuntimeException)
method.If the float index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeFrom(10.0f, 9.0f); >> IndexOutOfBoundsException
If the float index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0f, 10.0f);
- パラメータ:
index
- The float index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the float number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from, String message)
Ensures that the floatindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(float, float, RuntimeException)
method.If the float index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeFrom(10.0f, 9.0f, "any message"); >> IndexOutOfBoundsException
If the float index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0f, 10.0f, "any message");
- パラメータ:
index
- The float index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument floatindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from, RuntimeException exception)
Ensures that the floatindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(float, float)
method.If the float index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
Preconditions.requireRangeFrom(10.0f, 9.0f, new AnyRuntimeException()); >> AnyRuntimeException
If the float index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0f, 10.0f, new AnyRuntimeException());
- パラメータ:
index
- The float index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the float number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeFrom(double, double, RuntimeException)
method.If the double index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeFrom(10.0d, 9.0d); >> IndexOutOfBoundsException
If the double index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0d, 10.0d);
- パラメータ:
index
- The double index to be validatedfrom
- The lower limit- 例外:
IndexOutOfBoundsException
- If the double number of theindex
argument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from, String message)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeFrom(double, double, RuntimeException)
method.If the double index passed as an argument is less than the number specified by from, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeFrom(10.0d, 9.0d, "any message"); >> IndexOutOfBoundsException
If the double index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0d, 10.0d, "any message");
- パラメータ:
index
- The double index to be validatedfrom
- The lower limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument doubleindex
does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from, RuntimeException exception)
Ensures that the doubleindex
argument is a number within the range specified byfrom
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeFrom(double, double)
method.If the double index passed as an argument is less than the number specified by from, any of the specified exceptions will be thrown.
Preconditions.requireRangeFrom(10.0d, 9.0d, new AnyRuntimeException()); >> AnyRuntimeException
If the double index passed as an argument is greater than or equal to the value specified by "from", this function does nothing and exits the validation process.
Preconditions.requireRangeFrom(9.0d, 10.0d, new AnyRuntimeException());
- パラメータ:
index
- The double index to be validatedfrom
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the double number of theindex
specified as an argument does not fall within the range specified byfrom
-
requireRangeTo
public static void requireRangeTo(int index, int to)
Ensures that theindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(int, int, RuntimeException)
method.If the index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeTo(10, 9); >> IndexOutOfBoundsException
If the index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9, 10);
- パラメータ:
index
- The index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(int index, int to, String message)
Ensures that theindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(int, int, RuntimeException)
method.If the index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeTo(10, 9, "any message"); >> IndexOutOfBoundsException
If the index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9, 10, "any message");
- パラメータ:
index
- The index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argumentindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(int index, int to, RuntimeException exception)
Ensures that theindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(int, int)
method.If the index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
Preconditions.requireRangeTo(10, 9, new AnyRuntimeException()); >> AnyRuntimeException
If the index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9, 10, new AnyRuntimeException());
- パラメータ:
index
- The index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the number of theindex
specified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to)
Ensures that the longindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(long, long, RuntimeException)
method.If the long index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeTo(10L, 9L); >> IndexOutOfBoundsException
If the long index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9L, 10L);
- パラメータ:
index
- The long index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the long number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to, String message)
Ensures that the longindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(long, long, RuntimeException)
method.If the long index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeTo(10L, 9L, "any message"); >> IndexOutOfBoundsException
If the long index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9L, 10L, "any message");
- パラメータ:
index
- The long index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument longindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to, RuntimeException exception)
Ensures that the longindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(long, long)
method.If the long index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
Preconditions.requireRangeTo(10L, 9L, new AnyRuntimeException()); >> AnyRuntimeException
If the long index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9L, 10L, new AnyRuntimeException());
- パラメータ:
index
- The long index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the long number of theindex
specified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to)
Ensures that the shortindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(short, short, RuntimeException)
method.If the short index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
short index = 10; short to = 9; Preconditions.requireRangeTo(index, to); >> IndexOutOfBoundsException
If the short index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
short index = 9; short to = 10; Preconditions.requireRangeTo(index, to);
- パラメータ:
index
- The short index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the short number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to, String message)
Ensures that the shortindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(short, short, RuntimeException)
method.If the short index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
short index = 10; short to = 9; Preconditions.requireRangeTo(index, to, "any message"); >> IndexOutOfBoundsException
If the short index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
short index = 9; short to = 10; Preconditions.requireRangeTo(index, to, "any message");
- パラメータ:
index
- The short index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument shortindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to, RuntimeException exception)
Ensures that the shortindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(short, short)
method.If the short index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
short index = 10; short to = 9; Preconditions.requireRangeTo(index, to, new AnyRuntimeException()); >> AnyRuntimeException
If the short index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
short index = 9; short to = 10; Preconditions.requireRangeTo(index, to, new AnyRuntimeException());
- パラメータ:
index
- The short index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the short number of theindex
specified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to)
Ensures that the byteindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(byte, byte, RuntimeException)
method.If the byte index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
byte index = 10; byte to = 9; Preconditions.requireRangeTo(index, to); >> IndexOutOfBoundsException
If the byte index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
byte index = 9; byte to = 10; Preconditions.requireRangeTo(index, to);
- パラメータ:
index
- The byte index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the byte number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to, String message)
Ensures that the byteindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(byte, byte, RuntimeException)
method.If the byte index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
byte index = 10; byte to = 9; Preconditions.requireRangeTo(index, to, "any message"); >> IndexOutOfBoundsException
If the byte index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
byte index = 9; byte to = 10; Preconditions.requireRangeTo(index, to, "any message");
- パラメータ:
index
- The byte index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument byteindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to, RuntimeException exception)
Ensures that the byteindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(byte, byte)
method.If the byte index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
byte index = 10; byte to = 9; Preconditions.requireRangeTo(index, to, new AnyRuntimeException()); >> AnyRuntimeException
If the byte index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
byte index = 9; byte to = 10; Preconditions.requireRangeTo(index, to, new AnyRuntimeException());
- パラメータ:
index
- The byte index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the byte number of theindex
specified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to)
Ensures that the floatindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(float, float, RuntimeException)
method.If the float index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeTo(10.0f, 9.0f); >> IndexOutOfBoundsException
If the float index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0f, 10.0f);
- パラメータ:
index
- The float index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the float number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to, String message)
Ensures that the floatindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(float, float, RuntimeException)
method.If the float index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeTo(10.0f, 9.0f, "any message"); >> IndexOutOfBoundsException
If the float index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0f, 10.0f, "any message");
- パラメータ:
index
- The float index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument floatindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to, RuntimeException exception)
Ensures that the floatindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(float, float)
method.If the float index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
Preconditions.requireRangeTo(10.0f, 9.0f, new AnyRuntimeException()); >> AnyRuntimeException
If the float index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0f, 10.0f, new AnyRuntimeException());
- パラメータ:
index
- The float index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the float number of theindex
specified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to)
Ensures that the doubleindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime.To specify an arbitrary exception object, use the
requireRangeTo(double, double, RuntimeException)
method.If the double index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown.
Preconditions.requireRangeTo(10.0d, 9.0d); >> IndexOutOfBoundsException
If the double index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0d, 10.0d);
- パラメータ:
index
- The double index to be validatedto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the double number of theindex
argument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to, String message)
Ensures that the doubleindex
argument is a number within the range specified byto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. And themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRangeTo(double, double, RuntimeException)
method.If the double index passed as an argument is greater than the number specified by to, IndexOutOfBoundsException will be thrown. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRangeTo(10.0d, 9.0d, "any message"); >> IndexOutOfBoundsException
If the double index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0d, 10.0d, "any message");
- パラメータ:
index
- The double index to be validatedto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the argument doubleindex
does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to, RuntimeException exception)
Ensures that the doubleindex
argument is a number within the range specified byto
.If
index
specified as an argument is not within the range specified byto
, throw any exception object specified as an argument.If you do not specify an arbitrary exception object, use the
requireRangeTo(double, double)
method.If the double index passed as an argument is greater than the number specified by to, any of the specified exceptions will be thrown.
Preconditions.requireRangeTo(10.0d, 9.0d, new AnyRuntimeException()); >> AnyRuntimeException
If the double index passed as an argument is less than or equal to the value specified by "to", this function does nothing and exits the validation process.
Preconditions.requireRangeTo(9.0d, 10.0d, new AnyRuntimeException());
- パラメータ:
index
- The double index to be validatedto
- The upper limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the double number of theindex
specified as an argument does not fall within the range specified byto
-
requireRange
public static void requireRange(int index, int from, int to)
Ensures that theindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(int, int, int, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the index passed as an argument is not within the range specified by from and to.
Preconditions.requireRange(10, 0, 9); >> IndexOutOfBoundsException
If the index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9, 0, 10);
- パラメータ:
index
- The index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(int index, int from, int to, String message)
Ensures that theindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(int, int, int, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRange(10, 0, 9, "any message"); >> IndexOutOfBoundsException
If the index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9, 0, 10, "any message");
- パラメータ:
index
- The index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(int index, int from, int to, RuntimeException exception)
Ensures that theindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(int, int, int)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(int, int, int)
method.If the index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
Preconditions.requireRange(10, 0, 9, new AnyRuntimeException()); >> AnyRuntimeException
If the index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9, 0, 10, new AnyRuntimeException());
- パラメータ:
index
- The index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(long index, long from, long to)
Ensures that the longindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(long, long, long, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the long index passed as an argument is not within the range specified by from and to.
Preconditions.requireRange(10L, 0L, 9L); >> IndexOutOfBoundsException
If the long index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9L, 0L, 10L);
- パラメータ:
index
- The long index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the long number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(long index, long from, long to, String message)
Ensures that the longindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(long, long, long, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the long index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRange(10L, 0L, 9L, "any message"); >> IndexOutOfBoundsException
If the long index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9L, 0L, 10L, "any message");
- パラメータ:
index
- The long index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the long number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(long index, long from, long to, RuntimeException exception)
Ensures that the longindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(long, long, long)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(long, long, long)
method.If the long index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
Preconditions.requireRange(10L, 0L, 9L, new AnyRuntimeException()); >> AnyRuntimeException
If the long index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9L, 0L, 10L, new AnyRuntimeException());
- パラメータ:
index
- The long index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the long number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(short index, short from, short to)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(short, short, short, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the short index passed as an argument is not within the range specified by from and to.
short index = 10; short from = 0; short to = 9; Preconditions.requireRange(index, from, to); >> IndexOutOfBoundsException
If the short index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
short index = 9; short from = 0; short to = 10; Preconditions.requireRange(index, from, to);
- パラメータ:
index
- The short index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the short number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(short index, short from, short to, String message)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(short, short, short, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the short index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
short index = 10; short from = 0; short to = 9; Preconditions.requireRange(index, from, to, "any message"); >> IndexOutOfBoundsException
If the short index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
short index = 9; short from = 0; short to = 10; Preconditions.requireRange(index, from, to, "any message");
- パラメータ:
index
- The short index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the short number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(short index, short from, short to, RuntimeException exception)
Ensures that the shortindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(short, short, short)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(short, short, short)
method.If the short index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
short index = 10; short from = 0; short to = 9; Preconditions.requireRange(index, from, to, new AnyRuntimeException()); >> AnyRuntimeException
If the short index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
short index = 9; short from = 0; short to = 10; Preconditions.requireRange(index, from, to, new AnyRuntimeException());
- パラメータ:
index
- The short index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the short number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(byte index, byte from, byte to)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(byte, byte, byte, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the byte index passed as an argument is not within the range specified by from and to.
byte index = 10; byte from = 0; byte to = 9; Preconditions.requireRange(index, from, to); >> IndexOutOfBoundsException
If the byte index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
byte index = 9; byte from = 0; byte to = 10; Preconditions.requireRange(index, from, to);
- パラメータ:
index
- The byte index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the byte number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(byte index, byte from, byte to, String message)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(byte, byte, byte, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the byte index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
byte index = 10; byte from = 0; byte to = 9; Preconditions.requireRange(index, from, to, "any message"); >> IndexOutOfBoundsException
If the byte index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
byte index = 9; byte from = 0; byte to = 10; Preconditions.requireRange(index, from, to, "any message");
- パラメータ:
index
- The byte index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the byte number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(byte index, byte from, byte to, RuntimeException exception)
Ensures that the byteindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(byte, byte, byte)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(byte, byte, byte)
method.If the byte index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
byte index = 10; byte from = 0; byte to = 9; Preconditions.requireRange(index, from, to, new AnyRuntimeException()); >> AnyRuntimeException
If the byte index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
byte index = 9; byte from = 0; byte to = 10; Preconditions.requireRange(index, from, to, new AnyRuntimeException());
- パラメータ:
index
- The byte index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the byte number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(float index, float from, float to)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(float, float, float, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the float index passed as an argument is not within the range specified by from and to.
Preconditions.requireRange(10.0f, 0.0f, 9.0f); >> IndexOutOfBoundsException
If the float index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0f, 0.0f, 10.0f);
- パラメータ:
index
- The float index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the float number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(float index, float from, float to, String message)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(float, float, float, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the float index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRange(10.0f, 0.0f, 9.0f, "any message"); >> IndexOutOfBoundsException
If the float index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0f, 0.0f, 10.0f, "any message");
- パラメータ:
index
- The float index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the float number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(float index, float from, float to, RuntimeException exception)
Ensures that the floatindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(float, float, float)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(float, float, float)
method.If the float index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
Preconditions.requireRange(10.0f, 0.0f, 9.0f, new AnyRuntimeException()); >> AnyRuntimeException
If the float index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0f, 0.0f, 10.0f, new AnyRuntimeException());
- パラメータ:
index
- The float index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the float number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(double index, double from, double to)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
is always raised at runtime.To specify an arbitrary exception object, use the
requireRange(double, double, double, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the double index passed as an argument is not within the range specified by from and to.
Preconditions.requireRange(10.0d, 0.0d, 9.0d); >> IndexOutOfBoundsException
If the double index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0d, 0.0d, 10.0d);
- パラメータ:
index
- The double index to be validatedfrom
- The lower limitto
- The upper limit- 例外:
IndexOutOfBoundsException
- If the double number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(double index, double from, double to, String message)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.If the
index
argument is an out-of-range number,IndexOutOfBoundsException
will always be raised at runtime. Themessage
passed as an argument is output as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireRange(double, double, double, RuntimeException)
method.IndexOutOfBoundsException will be thrown if the double index passed as an argument is not within the range specified by from and to. A message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireRange(10.0d, 0.0d, 9.0d, "any message"); >> IndexOutOfBoundsException
If the double index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0d, 0.0d, 10.0d, "any message");
- パラメータ:
index
- The double index to be validatedfrom
- The lower limitto
- The upper limitmessage
- Detailed messages to be output on exception throwing- 例外:
IndexOutOfBoundsException
- If the double number of theindex
argument does not fall within the range specified byfrom
toto
-
requireRange
public static void requireRange(double index, double from, double to, RuntimeException exception)
Ensures that the doubleindex
argument is within the range specified byfrom
toto
.Throws an arbitrary exception object if the argument
index
is an out-of-range number. Execute from therequireRange(double, double, double)
method, and throwIndexOutOfBoundsException
as an exception object if theindex
argument is not a number within the range specified byfrom
toto
.If you do not specify an arbitrary exception object, use the
requireRange(double, double, double)
method.If the double index passed as an argument is not within the range specified by from and to, any exception object passed as an argument will be thrown.
Preconditions.requireRange(10.0d, 0.0d, 9.0d, new AnyRuntimeException()); >> AnyRuntimeException
If the double index passed as an argument is within the range of from and to, it does nothing and ends the validation process.
Preconditions.requireRange(9.0d, 0.0d, 10.0d, new AnyRuntimeException());
- パラメータ:
index
- The double index to be validatedfrom
- The upper limitto
- The lower limitexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the exception object passed as an argument isnull
IndexOutOfBoundsException
- If the double number of theindex
argument does not fall within the range specified byfrom
toto
-
requireNonEmpty
public static void requireNonEmpty(List<?> list)
Ensures thatlist
passed as an argument is notnull
or an empty list.To specify an arbitrary exception object, use the
requireNonEmpty(List, RuntimeException)
method.NullPointerException will be thrown if the list passed as an argument is null.
Preconditions.requireNonEmpty(null); >> NullPointerException
PreconditionFailedException will be thrown if the list passed as an argument is an empty list.
Preconditions.requireNonEmpty(List.of()); >> PreconditionFailedException
If the list passed as an argument is not null and is not an empty list, the validation process is terminated without doing anything.
Preconditions.requireNonEmpty(List.of("test"));
- パラメータ:
list
- The list to be validated- 例外:
NullPointerException
- Iflist
is passed as an argument andnull
is passedPreconditionFailedException
- Iflist
passed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(List<?> list, String message)
Ensures thatlist
passed as an argument is notnull
or an empty list.To specify an arbitrary exception object, use
requireNonEmpty(List, RuntimeException)
method. Themessage
passed as an argument will be printed as a detailed message when an exception is thrown.If the list argument is null, NullPointerException will be thrown. A message passed as an argument will be output as a detailed message when an exception occurs.
Preconditions.requireNonEmpty(null, "any message"); >> NullPointerException
PreconditionFailedException is thrown if the list argument is an empty list. The message argument is output as a detailed message when an exception occurs.
Preconditions.requireNonEmpty(List.of(), "any message"); >> PreconditionFailedException
If the list passed as an argument is not null and is not an empty list, the validation process is terminated without doing anything.
Preconditions.requireNonEmpty(List.of("test"), "any message");
- パラメータ:
list
- The list to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
NullPointerException
- Iflist
is passed as an argument andnull
is passedPreconditionFailedException
- Iflist
passed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(List<?> list, RuntimeException exception)
Ensures thatlist
given as an argument is notnull
or an empty list.If
list
is an empty list, throw any exception object passed as an argument. If it is executed by therequireNonEmpty(List)
method andlist
is an empty list, it throwsPreconditionFailedException
as an exception object.NullPointerException will be thrown if the list passed as an argument is null.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerException
If the list passed as an argument is an empty list, any exception object passed as an argument is thrown.
Preconditions.requireNonEmpty(List.of(), new AnyRuntimeException()); >> AnyRuntimeException
If the list passed as an argument is not null and is not an empty list, the validation process is terminated without doing anything.
Preconditions.requireNonEmpty(List.of("test"), new AnyRuntimeException());
- パラメータ:
list
- The list to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- Iflist
passed as an argument isnull
or if the exception object passed as an argument isnull
PreconditionFailedException
- If it is executed by therequireNonEmpty(List)
method and thelist
passed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map)
Ensures thatmap
passed as an argument is notnull
or an empty map.To specify an arbitrary exception object, use the
requireNonEmpty(Map, RuntimeException)
method.If the map argument is null, NullPointerException will be thrown.
Preconditions.requireNonEmpty(null); >> NullPointerException
PreconditionFailedException will be thrown if the map passed as an argument is an empty map.
Preconditions.requireNonEmpty(Map.of()); >> PreconditionFailedException
If the map passed as an argument is not null and is not an empty map, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Map.of("test", "test"));
- パラメータ:
map
- The map to be validated- 例外:
PreconditionFailedException
- If themap
passed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map, String message)
Ensures thatmap
passed as an argument is notnull
or an empty map.To specify an arbitrary exception object, use the
requireNonEmpty(Map, RuntimeException)
method. Themessage
passed as an argument will be printed as a detailed message when an exception is thrown.If the map argument is null, NullPointerException will be thrown. A message passed as an argument will be printed as a detailed message if an exception is raised.
Preconditions.requireNonEmpty(null, "any message"); >> NullPointerException
If the map argument is an empty map, PreconditionFailedException will be thrown. The message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireNonEmpty(Map.of(), "any message"); >> PreconditionFailedException
If the map passed as an argument is not null and is not an empty map, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Map.of("test", "test"), "any message");
- パラメータ:
map
- The map to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If themap
passed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map, RuntimeException exception)
Ensures thatmap
passed as an argument is notnull
or an empty map.If
map
is an empty map, any exception object passed as an argument will be returned. Executed by therequireNonEmpty(Map)
method, if themap
passed as argument is an empty map, throwsPreconditionFailedException
as an exception object.If you do not specify an arbitrary exception object, use the
requireNonEmpty(Map)
method.If the map argument is null, NullPointerException will be thrown.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerException
If the map argument is an empty map, any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(Map.of(), new AnyRuntimeException()); >> AnyRuntimeException
If the map passed as an argument is not null and is not an empty map, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Map.of("test", "test"), new AnyRuntimeException());
- パラメータ:
map
- The map to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- Ifmap
passed as an argument isnull
, or if any exception object passed as an argument isnull
PreconditionFailedException
- If themap
argument is an empty map
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set)
Ensures thatset
passed as an argument is notnull
or an empty set.To specify an arbitrary exception object, use the
requireNonEmpty(Set, RuntimeException)
method.If the set argument is null, NullPointerException will be thrown.
Preconditions.requireNonEmpty(null); >> NullPointerException
PreconditionFailedException will be thrown if the set passed as an argument is an empty set.
Preconditions.requireNonEmpty(Set.of()); >> PreconditionFailedException
If the set passed as an argument is not null and is not an empty set, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Set.of("test"));
- パラメータ:
set
- The set to be validated- 例外:
PreconditionFailedException
- If theset
passed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set, String message)
Ensures thatset
passed as an argument is notnull
or an empty set.To specify an arbitrary exception object, use the
requireNonEmpty(Set, RuntimeException)
method. Themessage
passed as an argument will be printed as a detailed message when an exception is thrown.If the set argument is null, NullPointerException will be thrown. A message passed as an argument will be printed as a detailed message if an exception is raised.
Preconditions.requireNonEmpty(null, "any message"); >> NullPointerException
If the set argument is an empty set, PreconditionFailedException will be thrown. The message passed as an argument is output as a detailed message when an exception occurs.
Preconditions.requireNonEmpty(Set.of(), "any message"); >> PreconditionFailedException
If the set passed as an argument is not null and is not an empty set, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Set.of("test"), "any message");
- パラメータ:
set
- The set to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If theset
passed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set, RuntimeException exception)
Ensures thatset
passed as an argument is notnull
or an empty set.If
set
is an empty set, any exception object passed as an argument will be returned. Executed by therequireNonEmpty(Set)
method, if theset
passed as argument is an empty set, throwsPreconditionFailedException
as an exception object.If you do not specify an arbitrary exception object, use the
requireNonEmpty(Set)
method.If the set argument is null, NullPointerException will be thrown.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerException
If the set argument is an empty set, any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(Set.of(), new AnyRuntimeException()); >> AnyRuntimeException
If the set passed as an argument is not null and is not an empty set, the validation process is ended without doing anything.
Preconditions.requireNonEmpty(Set.of("test"), new AnyRuntimeException());
- パラメータ:
set
- The set to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- Ifset
passed as an argument isnull
, or if any exception object passed as an argument isnull
PreconditionFailedException
- If theset
argument is an empty set
-
requireNonEmpty
public static void requireNonEmpty(Object[] array)
Ensures that the array passed as an argument is notnull
or an empty array.Throws
PreconditionFailedException
if the argument is eithernull
or an empty array.To specify an arbitrary exception object, use the
requireNonEmpty(Object[], RuntimeException)
method.NullPointerException will be thrown if the argument passed to array is null.
Preconditions.requireNonEmpty(null); >> NullPointerException
PreconditionFailedException will be thrown if the array argument is an empty array.
Preconditions.requireNonEmpty(new String[] {}); >> PreconditionFailedException
If the array argument is non-null and is not an empty array, the function does nothing and exits the validation process.
Preconditions.requireNonEmpty(new String[] { "" });
- パラメータ:
array
- The array to be validated- 例外:
NullPointerException
- If the array passed as an argument isnull
PreconditionFailedException
- If the array passed as an argument is an empty array
-
requireNonEmpty
public static void requireNonEmpty(Object[] array, String message)
Ensures that the array passed as an argument is notnull
or an empty array.Throws
PreconditionFailedException
if the array argument isnull
or an empty array. Themessage
passed as an argument will be printed as a detailed message when an exception occurs.To specify an arbitrary exception object, use the
requireNonEmpty(Object[], RuntimeException)
method.If the array argument is null, NullPointerException will be thrown. A message passed as an argument will be printed as a detailed message when an exception is raised.
Preconditions.requireNonEmpty(null, "any message"); >> NullPointerException
PreconditionFailedException is thrown if the array argument is an empty array. The message argument is output as a detailed message when an exception is raised.
Preconditions.requireNonEmpty(new String[] {}, "any message"); >> PreconditionFailedException
If the array argument is non-null and is not an empty array, the function does nothing and exits the validation process.
Preconditions.requireNonEmpty(new String[] { "" }, "any message");
- パラメータ:
array
- The array to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
NullPointerException
- If the array passed as an argument isnull
PreconditionFailedException
- If the array passed as an argument is an empty array
-
requireNonEmpty
public static void requireNonEmpty(Object[] array, RuntimeException exception)
Ensures that the array passed as a number is notnull
or an empty array.If the array passed as an argument is an empty array, throw an arbitrary exception object passed as an argument. Execute a
requireNonEmpty(Object[])
method and then throwPreconditionFailedException
if the array passed in as argument is an empty array.A NullPointerException will be thrown if the argument passed to array is null.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerException
If the array argument is an empty array, then any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(new String[] {}, new AnyRuntimeException()); >> AnyRuntimeException
If the array argument is non-null and is not an empty array, the function does nothing and exits the validation process.
Preconditions.requireNonEmpty(new String[] { "" }, new AnyRuntimeException());
- パラメータ:
array
- The array to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If the array passed as an argument isnull
or if the exception object passed as an argument isnull
PreconditionFailedException
- If the methodrequireNonEmpty(Object[])
is executed and the array passed as an argument is an empty array
-
requireStartWith
public static void requireStartWith(String string, String prefix)
Ensures that a given string begins with the prefix specified byprefix
.If the argument does not begin with a prefix specified by
prefix
,PreconditionFailedException
will be thrown as an exception object at runtime.To specify an arbitrary exception object, use the
requireStartWith(String, String, RuntimeException)
method.If the string specified as an argument does not begin with a prefix, PreconditionFailedException will be thrown.
Preconditions.requireStartWith("test", "est"); >> PreconditionFailedException
If the string argument begins with a prefix, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "test");
- パラメータ:
string
- The string to be validatedprefix
- The prefix- 例外:
PreconditionFailedException
- If a string passed as an argument does not start with a prefix specified byprefix
-
requireStartWith
public static void requireStartWith(String string, String prefix, String message)
Ensures that a given string begins with the prefix specified byprefix
.If the argument doesn't start with a prefix specified by
prefix
, thenPreconditionFailedException
will be thrown at runtime as an exception object. Themessage
passed as an argument will be printed as a detailed message when the exception occurs.To specify an arbitrary exception object, use the
requireStartWith(String, String, RuntimeException)
method.If the string argument does not begin with the prefix prefix, PreconditionFailedException will be thrown. A message passed as an argument will be printed as a detailed message when an exception occurs.
Preconditions.requireStartWith("test", "est", "any message"); >> PreconditionFailedException
If the string argument begins with a prefix, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "test", "any message");
- パラメータ:
string
- The string to be validatedprefix
- The prefixmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If a string passed as an argument does not start with a prefix specified byprefix
-
requireStartWith
public static void requireStartWith(String string, String prefix, int offset)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.If the argument does not begin with a prefix specified by
prefix
,PreconditionFailedException
will be thrown as an exception object at runtime.To specify an arbitrary exception object, use the
requireStartWith(String, String, int, RuntimeException)
method.If the string specified as an argument does not begin at the search start position specified by offset and the prefix specified by prefix, PreconditionFailedException will be thrown.
Preconditions.requireStartWith("test", "st", 1); >> PreconditionFailedException
If the string specified as an argument begins with a prefix specified by prefix from the search start position specified by offset, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "est", 1);
- パラメータ:
string
- The string to be validatedprefix
- The prefixoffset
- The offset- 例外:
PreconditionFailedException
- If a string passed as an argument does not start with a prefix specified byprefix
from the specified search start point
-
requireStartWith
public static void requireStartWith(String string, String prefix, int offset, String message)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.If the argument doesn't start with a prefix specified by
prefix
, thenPreconditionFailedException
will be thrown at runtime as an exception object. Themessage
passed as an argument will be printed as a detailed message when the exception occurs.To specify an arbitrary exception object, use the
requireStartWith(String, String, int, RuntimeException)
method.If the string argument does not begin at the search start position specified by offset and the prefix specified by prefix, an PreconditionFailedException will be thrown. A message passed as an argument will be printed as a detailed message when an exception occurs.
Preconditions.requireStartWith("test", "st", 1, "any message"); >> PreconditionFailedException
If the string specified as an argument begins with a prefix specified by prefix from the search start position specified by offset, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "est", 1, "any message");
- パラメータ:
string
- The string to be validatedprefix
- The prefixoffset
- The offsetmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If a string passed as an argument does not begin with the prefix specified byprefix
at the specified search start position
-
requireStartWith
public static void requireStartWith(String string, String prefix, RuntimeException exception)
Ensures that a given string begins with the prefix specified byprefix
.If a string specified as an argument does not begin with a prefix specified by
prefix
, any exception object specified as an argument will be thrown at runtime.If you do not specify an arbitrary exception object, use the
requireStartWith(String, String)
method.If the string argument does not begin with the prefix prefix, then any exception object specified as an argument is thrown.
Preconditions.requireStartWith("test", "est", new AnyRuntimeException()); >> AnyRuntimeException
If the string argument begins with a prefix, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "test", new AnyRuntimeException());
- パラメータ:
string
- The string to be validatedprefix
- The prefixexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If any exception object specified as an argument isnull
-
requireStartWith
public static void requireStartWith(String string, String prefix, int offset, RuntimeException exception)
Ensures that the argument starts with the prefix specified byprefix
at the specified search start point.If the string specified as an argument does not begin with a prefix specified by
prefix
, any exception object passed as an argument is thrown.If you do not specify an arbitrary exception object, use the
requireStartWith(String, String, int)
method.If the string specified as an argument does not begin at the search start position specified by offset and prefixed by prefix, then any exception object specified as an argument is thrown.
Preconditions.requireStartWith("test", "st", 1, new AnyRuntimeException()); >> AnyRuntimeException
If the string specified as an argument begins with a prefix specified by prefix from the search start position specified by offset, the function does nothing and ends the validation process.
Preconditions.requireStartWith("test", "est", 1, new AnyRuntimeException());
- パラメータ:
string
- The string to be validatedprefix
- The prefixoffset
- The offsetexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If any exception object passed as an argument isnull
-
requireEndWith
public static void requireEndWith(String string, String suffix)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.If the string specified as an argument does not end with the suffix specified by
suffix
, thenPreconditionFailedException
is thrown as an exception object at runtime.To specify an arbitrary exception object, use the
requireEndWith(String, String, RuntimeException)
method.If the string specified as an argument does not end with the suffix specified by suffix, PreconditionFailedException will be thrown.
Preconditions.requireEndWith("test", "es"); >> PreconditionFailedException
If the string argument ends with a suffix, the function does nothing and ends the validation process.
Preconditions.requireEndWith("test", "est");
- パラメータ:
string
- The string to be validatedsuffix
- The suffix- 例外:
PreconditionFailedException
- If the string passed as an argument does not end with the suffix specified bysuffix
-
requireEndWith
public static void requireEndWith(String string, String suffix, String message)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.If the string passed as an argument does not end with the suffix specified by
suffix
,PreconditionFailedException
will be thrown as an exception object at runtime. Anymessage
passed as an argument will be printed as a detail message when the exception occurs.To specify an arbitrary exception object, use the
requireEndWith(String, String, RuntimeException)
method.If the string argument does not end with the suffix specified by suffix, PreconditionFailedException will be thrown. A message passed as an argument will be printed as a detailed message if an exception is thrown.
Preconditions.requireEndWith("test", "es", "any message"); >> PreconditionFailedException
If the string argument ends with a suffix, the function does nothing and ends the validation process.
Preconditions.requireEndWith("test", "est", "any message");
- パラメータ:
string
- The string to be validatedsuffix
- The suffixmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the string passed as an argument does not end with the suffix specified bysuffix
-
requireEndWith
public static void requireEndWith(String string, String suffix, RuntimeException exception)
Ensures that the string specified as an argument ends with the suffix specified bysuffix
.If the string specified as an argument does not end with the suffix specified by
suffix
, then any exception object specified as an argument will be thrown at runtime.If you want to specify an arbitrary exception object, use the
requireEndWith(String, String)
method.If the string specified as an argument does not end with the suffix specified by suffix, then any exception object specified as an argument is thrown.
Preconditions.requireEndWith("test", "es", new AnyRuntimeException()); >> AnyRuntimeException
If the string argument ends with a suffix, the function does nothing and ends the validation process.
Preconditions.requireEndWith("test", "est", new AnyRuntimeException());
- パラメータ:
string
- The string to be validatedsuffix
- The suffixexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If any exception object specified as an argument isnull
-
requireTrue
public static void requireTrue(boolean bool)
Ensures that the boolean value given as an argument istrue
.To specify an arbitrary exception object, use the
requireTrue(boolean, RuntimeException)
method.If the boolean is false, then
PreconditionFailedException
is thrown.Preconditions.requireTrue(false); >> PreconditionFailedException
If the boolean is true, the function does nothing and ends the validation process.
Preconditions.requireTrue(true);
- パラメータ:
bool
- The value to be validated- 例外:
PreconditionFailedException
- If the boolean value given as an argument isfalse
-
requireTrue
public static void requireTrue(boolean bool, String message)
Ensures that the boolean value given as an argument istrue
.If the boolean passed as an argument is
false
,PreconditionFailedException
will be thrown as an exception object at runtime. Anymessage
passed as an argument will be printed as a detail message when the exception occurs.To specify an arbitrary exception object, use the
requireTrue(boolean, RuntimeException)
method.If the boolean is false, then
PreconditionFailedException
is thrown.Preconditions.requireTrue(false, "any message"); >> PreconditionFailedException
If the boolean is true, the function does nothing and ends the validation process.
Preconditions.requireTrue(true, "any message");
- パラメータ:
bool
- The value to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the boolean value given as an argument isfalse
-
requireTrue
public static void requireTrue(boolean bool, RuntimeException exception)
Ensures that the boolean value given as an argument istrue
.If the boolean specified as an argument is
false
, then any exception object specified as an argument will be thrown at runtime.Use
requireTrue(boolean)
method if you do not specify any exception objects.If the boolean is false, then any exception object specified as an argument thrown.
Preconditions.requireTrue(false, new AnyRuntimeException()); >> AnyRuntimeException
If the boolean is true, the function does nothing and ends the validation process.
Preconditions.requireTrue(true, new AnyRuntimeException());
- パラメータ:
bool
- The value to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If any exception object specified as an argument isnull
-
requireFalse
public static void requireFalse(boolean bool)
Ensures that the boolean value given as an argument isfalse
.To specify an arbitrary exception object, use the
requireFalse(boolean, RuntimeException)
method.If the boolean is true, then
PreconditionFailedException
is thrown.Preconditions.requireFalse(true); >> PreconditionFailedException
If the boolean is false, the function does nothing and ends the validation process.
Preconditions.requireFalse(false);
- パラメータ:
bool
- The value to be validated- 例外:
PreconditionFailedException
- If the boolean value given as an argument istrue
-
requireFalse
public static void requireFalse(boolean bool, String message)
Ensures that the boolean value given as an argument isfalse
.If the boolean passed as an argument is
true
,PreconditionFailedException
will be thrown as an exception object at runtime. Anymessage
passed as an argument will be printed as a detail message when the exception occurs.To specify an arbitrary exception object, use the
requireFalse(boolean, RuntimeException)
method.If the boolean is true, then
PreconditionFailedException
is thrown.Preconditions.requireFalse(true, "any message"); >> PreconditionFailedException
If the boolean is false, the function does nothing and ends the validation process.
Preconditions.requireFalse(false, "any message");
- パラメータ:
bool
- The value to be validatedmessage
- Detailed messages to be output on exception throwing- 例外:
PreconditionFailedException
- If the boolean value given as an argument istrue
-
requireFalse
public static void requireFalse(boolean bool, RuntimeException exception)
Ensures that the boolean value given as an argument isfalse
.If the boolean specified as an argument is
true
, then any exception object specified as an argument will be thrown at runtime.Use
requireFalse(boolean)
method if you do not specify any exception objects.If the boolean is true, then any exception object specified as an argument is thrown.
Preconditions.requireFalse(true, new AnyRuntimeException()); >> AnyRuntimeException
If the boolean is false, the function does nothing and ends the validation process.
Preconditions.requireFalse(false, new AnyRuntimeException());
- パラメータ:
bool
- The value to be validatedexception
- Any exception object that is thrown if the preconditions are not met- 例外:
NullPointerException
- If any exception object specified as an argument isnull
-
-