クラス Preconditions
- java.lang.Object
-
- org.thinkit.common.base.precondition.Preconditions
-
public final class Preconditions extends Object
ThePreconditionsprovides a way to ensure the preconditions for arguments and data at the start of the process.Each of the features provided by the
Preconditionsvalidates 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(""); >> PreconditionFailedExceptionYou 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 voidrequireEndWith(String string, String suffix)Ensures that the string specified as an argument ends with the suffix specified bysuffix.static voidrequireEndWith(String string, String suffix, RuntimeException exception)Ensures that the string specified as an argument ends with the suffix specified bysuffix.static voidrequireEndWith(String string, String suffix, String message)Ensures that the string specified as an argument ends with the suffix specified bysuffix.static voidrequireFalse(boolean bool)Ensures that the boolean value given as an argument isfalse.static voidrequireFalse(boolean bool, RuntimeException exception)Ensures that the boolean value given as an argument isfalse.static voidrequireFalse(boolean bool, String message)Ensures that the boolean value given as an argument isfalse.static voidrequireNegative(byte number)Ensures that the argumentnumberis a negative byte number.static voidrequireNegative(byte number, RuntimeException exception)Ensures that the argumentnumberis a negative byte number.static voidrequireNegative(byte number, String message)Ensures that the argumentnumberis a negative byte number.static voidrequireNegative(double number)Ensures that the argumentnumberis a negative double number.static voidrequireNegative(double number, RuntimeException exception)Ensures that the argumentnumberis a negative double number.static voidrequireNegative(double number, String message)Ensures that the argumentnumberis a negative double number.static voidrequireNegative(float number)Ensures that the argumentnumberis a negative float number.static voidrequireNegative(float number, RuntimeException exception)Ensures that the argumentnumberis a negative float number.static voidrequireNegative(float number, String message)Ensures that the argumentnumberis a negative float number.static voidrequireNegative(int number)Ensures that the argumentnumberis a negative number.static voidrequireNegative(int number, RuntimeException exception)Ensures that the argumentnumberis a negative number.static voidrequireNegative(int number, String message)Ensures that the argumentnumberis a negative number.static voidrequireNegative(long number)Ensures that the argumentnumberis a negative long number.static voidrequireNegative(long number, RuntimeException exception)Ensures that the argumentnumberis a negative long number.static voidrequireNegative(long number, String message)Ensures that the argumentnumberis a negative long number.static voidrequireNegative(short number)Ensures that the argumentnumberis a negative short number.static voidrequireNegative(short number, RuntimeException exception)Ensures that the argumentnumberis a negative short number.static voidrequireNegative(short number, String message)Ensures that the argumentnumberis a negative short number.static voidrequireNonBlank(String string)Ensures that the string of thestringobject given as an argument is not an empty string.static voidrequireNonBlank(String string, RuntimeException exception)Ensures thatstringgiven as an argument is not an empty string.static voidrequireNonBlank(String string, String message)Ensures that the string of thestringobject given as an argument is not an empty string.static voidrequireNonEmpty(Object[] array)Ensures that the array passed as an argument is notnullor an empty array.static voidrequireNonEmpty(Object[] array, RuntimeException exception)Ensures that the array passed as a number is notnullor an empty array.static voidrequireNonEmpty(Object[] array, String message)Ensures that the array passed as an argument is notnullor an empty array.static voidrequireNonEmpty(String string)Ensures that the reference to thestringobject specified as an argument is notnullor the string is not an empty string.static voidrequireNonEmpty(String string, RuntimeException exception)Ensures that the value ofstringpassed as an argument is notnullor an empty string.static voidrequireNonEmpty(String string, String message)Ensures that the reference to thestringobject specified as an argument is notnullor the string is not an empty string.static voidrequireNonEmpty(List<?> list)Ensures thatlistpassed as an argument is notnullor an empty list.static voidrequireNonEmpty(List<?> list, RuntimeException exception)Ensures thatlistgiven as an argument is notnullor an empty list.static voidrequireNonEmpty(List<?> list, String message)Ensures thatlistpassed as an argument is notnullor an empty list.static voidrequireNonEmpty(Map<?,?> map)Ensures thatmappassed as an argument is notnullor an empty map.static voidrequireNonEmpty(Map<?,?> map, RuntimeException exception)Ensures thatmappassed as an argument is notnullor an empty map.static voidrequireNonEmpty(Map<?,?> map, String message)Ensures thatmappassed as an argument is notnullor an empty map.static voidrequireNonEmpty(Set<?> set)Ensures thatsetpassed as an argument is notnullor an empty set.static voidrequireNonEmpty(Set<?> set, RuntimeException exception)Ensures thatsetpassed as an argument is notnullor an empty set.static voidrequireNonEmpty(Set<?> set, String message)Ensures thatsetpassed as an argument is notnullor an empty set.static voidrequireNonNull(Object object)Ensures that the reference to theobjectobject passed as an argument is notnull.static voidrequireNonNull(Object object, RuntimeException exception)Ensures that the reference to theobjectobject passed as an argument is notnull.static voidrequireNonNull(Object object, String message)Ensures that the reference to theobjectobject passed as an argument is notnull.static voidrequirePositive(byte number)Ensures that thenumberargument is a positive byte number.static voidrequirePositive(byte number, RuntimeException exception)Ensures that thenumberargument is a positive byte number.static voidrequirePositive(byte number, String message)Ensures that thenumberargument is a positive byte number.static voidrequirePositive(double number)Ensures that thenumberargument is a positive double number.static voidrequirePositive(double number, RuntimeException exception)Ensures that thenumberargument is a positive double number.static voidrequirePositive(double number, String message)Ensures that thenumberargument is a positive double number.static voidrequirePositive(float number)Ensures that thenumberargument is a positive float number.static voidrequirePositive(float number, RuntimeException exception)Ensures that thenumberargument is a positive float number.static voidrequirePositive(float number, String message)Ensures that thenumberargument is a positive float number.static voidrequirePositive(int number)Ensures that thenumberargument is a positive number.static voidrequirePositive(int number, RuntimeException exception)Ensures that thenumberargument is a positive number.static voidrequirePositive(int number, String message)Ensures that thenumberargument is a positive number.static voidrequirePositive(long number)Ensures that thenumberargument is a positive long number.static voidrequirePositive(long number, RuntimeException exception)Ensures that thenumberargument is a positive long number.static voidrequirePositive(long number, String message)Ensures that thenumberargument is a positive long number.static voidrequirePositive(short number)Ensures that thenumberargument is a positive short number.static voidrequirePositive(short number, RuntimeException exception)Ensures that thenumberargument is a positive short number.static voidrequirePositive(short number, String message)Ensures that thenumberargument is a positive short number.static voidrequireRange(byte index, byte from, byte to)Ensures that the byteindexargument is within the range specified byfromtoto.static voidrequireRange(byte index, byte from, byte to, RuntimeException exception)Ensures that the byteindexargument is within the range specified byfromtoto.static voidrequireRange(byte index, byte from, byte to, String message)Ensures that the byteindexargument is within the range specified byfromtoto.static voidrequireRange(double index, double from, double to)Ensures that the doubleindexargument is within the range specified byfromtoto.static voidrequireRange(double index, double from, double to, RuntimeException exception)Ensures that the doubleindexargument is within the range specified byfromtoto.static voidrequireRange(double index, double from, double to, String message)Ensures that the doubleindexargument is within the range specified byfromtoto.static voidrequireRange(float index, float from, float to)Ensures that the floatindexargument is within the range specified byfromtoto.static voidrequireRange(float index, float from, float to, RuntimeException exception)Ensures that the floatindexargument is within the range specified byfromtoto.static voidrequireRange(float index, float from, float to, String message)Ensures that the floatindexargument is within the range specified byfromtoto.static voidrequireRange(int index, int from, int to)Ensures that theindexargument is within the range specified byfromtoto.static voidrequireRange(int index, int from, int to, RuntimeException exception)Ensures that theindexargument is within the range specified byfromtoto.static voidrequireRange(int index, int from, int to, String message)Ensures that theindexargument is within the range specified byfromtoto.static voidrequireRange(long index, long from, long to)Ensures that the longindexargument is within the range specified byfromtoto.static voidrequireRange(long index, long from, long to, RuntimeException exception)Ensures that the longindexargument is within the range specified byfromtoto.static voidrequireRange(long index, long from, long to, String message)Ensures that the longindexargument is within the range specified byfromtoto.static voidrequireRange(short index, short from, short to)Ensures that the shortindexargument is within the range specified byfromtoto.static voidrequireRange(short index, short from, short to, RuntimeException exception)Ensures that the shortindexargument is within the range specified byfromtoto.static voidrequireRange(short index, short from, short to, String message)Ensures that the shortindexargument is within the range specified byfromtoto.static voidrequireRangeFrom(byte index, byte from)Ensures that the byteindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(byte index, byte from, RuntimeException exception)Ensures that the byteindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(byte index, byte from, String message)Ensures that the byteindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(double index, double from)Ensures that the doubleindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(double index, double from, RuntimeException exception)Ensures that the doubleindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(double index, double from, String message)Ensures that the doubleindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(float index, float from)Ensures that the floatindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(float index, float from, RuntimeException exception)Ensures that the floatindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(float index, float from, String message)Ensures that the floatindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(int index, int from)Ensures that theindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(int index, int from, RuntimeException exception)Ensures that theindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(int index, int from, String message)Ensures that theindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(long index, long from)Ensures that the longindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(long index, long from, RuntimeException exception)Ensures that the longindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(long index, long from, String message)Ensures that the longindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(short index, short from)Ensures that the shortindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(short index, short from, RuntimeException exception)Ensures that the shortindexargument is a number within the range specified byfrom.static voidrequireRangeFrom(short index, short from, String message)Ensures that the shortindexargument is a number within the range specified byfrom.static voidrequireRangeTo(byte index, byte to)Ensures that the byteindexargument is a number within the range specified byto.static voidrequireRangeTo(byte index, byte to, RuntimeException exception)Ensures that the byteindexargument is a number within the range specified byto.static voidrequireRangeTo(byte index, byte to, String message)Ensures that the byteindexargument is a number within the range specified byto.static voidrequireRangeTo(double index, double to)Ensures that the doubleindexargument is a number within the range specified byto.static voidrequireRangeTo(double index, double to, RuntimeException exception)Ensures that the doubleindexargument is a number within the range specified byto.static voidrequireRangeTo(double index, double to, String message)Ensures that the doubleindexargument is a number within the range specified byto.static voidrequireRangeTo(float index, float to)Ensures that the floatindexargument is a number within the range specified byto.static voidrequireRangeTo(float index, float to, RuntimeException exception)Ensures that the floatindexargument is a number within the range specified byto.static voidrequireRangeTo(float index, float to, String message)Ensures that the floatindexargument is a number within the range specified byto.static voidrequireRangeTo(int index, int to)Ensures that theindexargument is a number within the range specified byto.static voidrequireRangeTo(int index, int to, RuntimeException exception)Ensures that theindexargument is a number within the range specified byto.static voidrequireRangeTo(int index, int to, String message)Ensures that theindexargument is a number within the range specified byto.static voidrequireRangeTo(long index, long to)Ensures that the longindexargument is a number within the range specified byto.static voidrequireRangeTo(long index, long to, RuntimeException exception)Ensures that the longindexargument is a number within the range specified byto.static voidrequireRangeTo(long index, long to, String message)Ensures that the longindexargument is a number within the range specified byto.static voidrequireRangeTo(short index, short to)Ensures that the shortindexargument is a number within the range specified byto.static voidrequireRangeTo(short index, short to, RuntimeException exception)Ensures that the shortindexargument is a number within the range specified byto.static voidrequireRangeTo(short index, short to, String message)Ensures that the shortindexargument is a number within the range specified byto.static voidrequireStartWith(String string, String prefix)Ensures that a given string begins with the prefix specified byprefix.static voidrequireStartWith(String string, String prefix, int offset)Ensures that the argument starts with the prefix specified byprefixat the specified search start point.static voidrequireStartWith(String string, String prefix, int offset, RuntimeException exception)Ensures that the argument starts with the prefix specified byprefixat the specified search start point.static voidrequireStartWith(String string, String prefix, int offset, String message)Ensures that the argument starts with the prefix specified byprefixat the specified search start point.static voidrequireStartWith(String string, String prefix, RuntimeException exception)Ensures that a given string begins with the prefix specified byprefix.static voidrequireStartWith(String string, String prefix, String message)Ensures that a given string begins with the prefix specified byprefix.static voidrequireTrue(boolean bool)Ensures that the boolean value given as an argument istrue.static voidrequireTrue(boolean bool, RuntimeException exception)Ensures that the boolean value given as an argument istrue.static voidrequireTrue(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 theobjectobject passed as an argument is notnull.NullPointerExceptionis always raised at runtime if the reference to theobjectobject 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); >> NullPointerExceptionIf 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- Ifobjectpassed as an argument isnull
-
requireNonNull
public static void requireNonNull(Object object, String message)
Ensures that the reference to theobjectobject passed as an argument is notnull.If the
objectobject is referenced bynull, thenNullPointerExceptionis always raised at runtime. Themessagepassed 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"); >> NullPointerExceptionIf 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- Ifobjectpassed as an argument isnull
-
requireNonNull
public static void requireNonNull(Object object, RuntimeException exception)
Ensures that the reference to theobjectobject passed as an argument is notnull.If the reference to a
objectobject 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()); >> AnyRuntimeExceptionIf 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 thestringobject given as an argument is not an empty string.PreconditionFailedExceptionis always raised at runtime if the string of thestringobject is an empty string.Use the
requireNonEmpty(String)method if a reference to astringobject 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(""); >> PreconditionFailedExceptionIf 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- Ifnullis 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 thestringobject given as an argument is not an empty string.If the string of a
stringobject is an empty string,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed as an argument is output as a detailed message when an exception occurs.Use the
requireNonEmpty(String)method if a reference to astringobject 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"); >> PreconditionFailedExceptionIf 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- Ifnullis passed as an argumentPreconditionFailedException- If an empty string is passed as an argument
-
requireNonBlank
public static void requireNonBlank(String string, RuntimeException exception)
Ensures thatstringgiven as an argument is not an empty string.Throws an
exceptionobject if the argumentstringis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If executed by therequireNonBlank(String)method and thestringpassed as an argument is an empty string
-
requireNonEmpty
public static void requireNonEmpty(String string)
Ensures that the reference to thestringobject specified as an argument is notnullor the string is not an empty string.NullPointerExceptionis always raised at runtime if the reference to astringobject isnull. AndPreconditionFailedExceptionis always raised at runtime if the string of thestringobject 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); >> NullPointerExceptionPreconditionFailedException will be thrown if the argument passed to string is an empty string.
Preconditions.requireNonEmpty(""); >> PreconditionFailedExceptionIf 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- Ifnullis 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 thestringobject specified as an argument is notnullor the string is not an empty string.If the
stringobject is referenced bynull, thenNullPointerExceptionis always raised at runtime. Themessagepassed as an argument is output as a detailed message when an exception occurs.If the string of a
stringobject is an empty string,PreconditionFailedExceptionis always raised at runtime. Themessagepassed 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"); >> NullPointerExceptionPreconditionFailedException 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"); >> PreconditionFailedExceptionIf 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- Ifnullis 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 ofstringpassed as an argument is notnullor an empty string.Throws an exception if it is
nullor 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()); >> NullPointerExceptionIf the argument string is an empty string, any exception object specified as an argument will be thrown.
Preconditions.requireNonEmpty("", new AnyRuntimeException()); >> AnyRuntimeExceptionIf 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 isnullor if thestringpassed as an argument isnullPreconditionFailedException- Ifstringpassed as an argument is an empty string
-
requirePositive
public static void requirePositive(int number)
Ensures that thenumberargument is a positive number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(int number, String message)Ensures that thenumberargument is a positive number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(int number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specifiednumberis negative
-
requirePositive
public static void requirePositive(long number)
Ensures that thenumberargument is a positive long number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(long number, String message)Ensures that thenumberargument is a positive long number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(long number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specified longnumberis negative
-
requirePositive
public static void requirePositive(short number)
Ensures that thenumberargument is a positive short number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(short number, String message)Ensures that thenumberargument is a positive short number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(short number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specified shortnumberis negative
-
requirePositive
public static void requirePositive(byte number)
Ensures that thenumberargument is a positive byte number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(byte number, String message)Ensures that thenumberargument is a positive byte number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(byte number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specified bytenumberis negative
-
requirePositive
public static void requirePositive(float number)
Ensures that thenumberargument is a positive float number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(float number, String message)Ensures that thenumberargument is a positive float number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(float number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specified floatnumberis negative
-
requirePositive
public static void requirePositive(double number)
Ensures that thenumberargument is a positive double number.If the argument
numberis negative,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(double number, String message)Ensures that thenumberargument is a positive double number.If the argument
numberis negative,PreconditionFailedExceptionwill always be raised at runtime. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a negative number
-
requirePositive
public static void requirePositive(double number, RuntimeException exception)Ensures that thenumberargument 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the specified doublenumberis negative
-
requireNegative
public static void requireNegative(int number)
Ensures that the argumentnumberis a negative number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive number
-
requireNegative
public static void requireNegative(int number, String message)Ensures that the argumentnumberis a negative number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive number
-
requireNegative
public static void requireNegative(int number, RuntimeException exception)Ensures that the argumentnumberis a negative number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive number
-
requireNegative
public static void requireNegative(long number)
Ensures that the argumentnumberis a negative long number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive long number
-
requireNegative
public static void requireNegative(long number, String message)Ensures that the argumentnumberis a negative long number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive long number
-
requireNegative
public static void requireNegative(long number, RuntimeException exception)Ensures that the argumentnumberis a negative long number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive long number
-
requireNegative
public static void requireNegative(short number)
Ensures that the argumentnumberis a negative short number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive short number
-
requireNegative
public static void requireNegative(short number, String message)Ensures that the argumentnumberis a negative short number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive short number
-
requireNegative
public static void requireNegative(short number, RuntimeException exception)Ensures that the argumentnumberis a negative short number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive short number
-
requireNegative
public static void requireNegative(byte number)
Ensures that the argumentnumberis a negative byte number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive byte number
-
requireNegative
public static void requireNegative(byte number, String message)Ensures that the argumentnumberis a negative byte number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive byte number
-
requireNegative
public static void requireNegative(byte number, RuntimeException exception)Ensures that the argumentnumberis a negative byte number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive byte number
-
requireNegative
public static void requireNegative(float number)
Ensures that the argumentnumberis a negative float number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive float number
-
requireNegative
public static void requireNegative(float number, String message)Ensures that the argumentnumberis a negative float number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive float number
-
requireNegative
public static void requireNegative(float number, RuntimeException exception)Ensures that the argumentnumberis a negative float number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive float number
-
requireNegative
public static void requireNegative(double number)
Ensures that the argumentnumberis a negative double number.If the argument
numberis positive,PreconditionFailedExceptionis 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); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive double number
-
requireNegative
public static void requireNegative(double number, String message)Ensures that the argumentnumberis a negative double number.If the argument
numberis a positive number,PreconditionFailedExceptionwill always be raised at runtime. And themessagepassed 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"); >> PreconditionFailedExceptionIf 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 ofnumberspecified as an argument is a positive double number
-
requireNegative
public static void requireNegative(double number, RuntimeException exception)Ensures that the argumentnumberis a negative double number.If
numberis 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()); >> AnyRuntimeExceptionIf 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 isnullPreconditionFailedException- If the value of thenumberpassed as an argument is a positive double number
-
requireRangeFrom
public static void requireRangeFrom(int index, int from)Ensures that theindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(int index, int from, String message)Ensures that theindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 argumentindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(int index, int from, RuntimeException exception)Ensures that theindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from)Ensures that the longindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from, String message)Ensures that the longindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 longindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(long index, long from, RuntimeException exception)Ensures that the longindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the long number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from)Ensures that the shortindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from, String message)Ensures that the shortindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 shortindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(short index, short from, RuntimeException exception)Ensures that the shortindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the short number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from)Ensures that the byteindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from, String message)Ensures that the byteindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 byteindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(byte index, byte from, RuntimeException exception)Ensures that the byteindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the byte number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from)Ensures that the floatindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from, String message)Ensures that the floatindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 floatindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(float index, float from, RuntimeException exception)Ensures that the floatindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the float number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from)Ensures that the doubleindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from, String message)Ensures that the doubleindexargument is a number within the range specified byfrom.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 doubleindexdoes not fall within the range specified byfrom
-
requireRangeFrom
public static void requireRangeFrom(double index, double from, RuntimeException exception)Ensures that the doubleindexargument is a number within the range specified byfrom.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the double number of theindexspecified as an argument does not fall within the range specified byfrom
-
requireRangeTo
public static void requireRangeTo(int index, int to)Ensures that theindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(int index, int to, String message)Ensures that theindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 argumentindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(int index, int to, RuntimeException exception)Ensures that theindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the number of theindexspecified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to)Ensures that the longindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to, String message)Ensures that the longindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 longindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(long index, long to, RuntimeException exception)Ensures that the longindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the long number of theindexspecified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to)Ensures that the shortindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to, String message)Ensures that the shortindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 shortindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(short index, short to, RuntimeException exception)Ensures that the shortindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the short number of theindexspecified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to)Ensures that the byteindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to, String message)Ensures that the byteindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 byteindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(byte index, byte to, RuntimeException exception)Ensures that the byteindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the byte number of theindexspecified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to)Ensures that the floatindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to, String message)Ensures that the floatindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 floatindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(float index, float to, RuntimeException exception)Ensures that the floatindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the float number of theindexspecified as an argument does not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to)Ensures that the doubleindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not exist within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to, String message)Ensures that the doubleindexargument is a number within the range specified byto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. And themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 doubleindexdoes not fall within the range specified byto
-
requireRangeTo
public static void requireRangeTo(double index, double to, RuntimeException exception)Ensures that the doubleindexargument is a number within the range specified byto.If
indexspecified 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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the double number of theindexspecified as an argument does not fall within the range specified byto
-
requireRange
public static void requireRange(int index, int from, int to)Ensures that theindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(int index, int from, int to, String message)Ensures that theindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(int index, int from, int to, RuntimeException exception)Ensures that theindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(int, int, int)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the number of theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(long index, long from, long to)Ensures that the longindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(long index, long from, long to, String message)Ensures that the longindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(long index, long from, long to, RuntimeException exception)Ensures that the longindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(long, long, long)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the long number of theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(short index, short from, short to)Ensures that the shortindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(short index, short from, short to, String message)Ensures that the shortindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(short index, short from, short to, RuntimeException exception)Ensures that the shortindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(short, short, short)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the short number of theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(byte index, byte from, byte to)Ensures that the byteindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(byte index, byte from, byte to, String message)Ensures that the byteindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(byte index, byte from, byte to, RuntimeException exception)Ensures that the byteindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(byte, byte, byte)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the byte number of theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(float index, float from, float to)Ensures that the floatindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(float index, float from, float to, String message)Ensures that the floatindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(float index, float from, float to, RuntimeException exception)Ensures that the floatindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(float, float, float)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the float number of theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(double index, double from, double to)Ensures that the doubleindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionis 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); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(double index, double from, double to, String message)Ensures that the doubleindexargument is within the range specified byfromtoto.If the
indexargument is an out-of-range number,IndexOutOfBoundsExceptionwill always be raised at runtime. Themessagepassed 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"); >> IndexOutOfBoundsExceptionIf 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 theindexargument does not fall within the range specified byfromtoto
-
requireRange
public static void requireRange(double index, double from, double to, RuntimeException exception)Ensures that the doubleindexargument is within the range specified byfromtoto.Throws an arbitrary exception object if the argument
indexis an out-of-range number. Execute from therequireRange(double, double, double)method, and throwIndexOutOfBoundsExceptionas an exception object if theindexargument is not a number within the range specified byfromtoto.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()); >> AnyRuntimeExceptionIf 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 isnullIndexOutOfBoundsException- If the double number of theindexargument does not fall within the range specified byfromtoto
-
requireNonEmpty
public static void requireNonEmpty(List<?> list)
Ensures thatlistpassed as an argument is notnullor 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); >> NullPointerExceptionPreconditionFailedException will be thrown if the list passed as an argument is an empty list.
Preconditions.requireNonEmpty(List.of()); >> PreconditionFailedExceptionIf 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- Iflistis passed as an argument andnullis passedPreconditionFailedException- Iflistpassed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(List<?> list, String message)
Ensures thatlistpassed as an argument is notnullor an empty list.To specify an arbitrary exception object, use
requireNonEmpty(List, RuntimeException)method. Themessagepassed 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"); >> NullPointerExceptionPreconditionFailedException 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"); >> PreconditionFailedExceptionIf 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- Iflistis passed as an argument andnullis passedPreconditionFailedException- Iflistpassed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(List<?> list, RuntimeException exception)
Ensures thatlistgiven as an argument is notnullor an empty list.If
listis an empty list, throw any exception object passed as an argument. If it is executed by therequireNonEmpty(List)method andlistis an empty list, it throwsPreconditionFailedExceptionas an exception object.NullPointerException will be thrown if the list passed as an argument is null.
Preconditions.requireNonEmpty(null, new AnyRuntimeException()); >> NullPointerExceptionIf 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()); >> AnyRuntimeExceptionIf 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- Iflistpassed as an argument isnullor if the exception object passed as an argument isnullPreconditionFailedException- If it is executed by therequireNonEmpty(List)method and thelistpassed as an argument is an empty list
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map)
Ensures thatmappassed as an argument is notnullor 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); >> NullPointerExceptionPreconditionFailedException will be thrown if the map passed as an argument is an empty map.
Preconditions.requireNonEmpty(Map.of()); >> PreconditionFailedExceptionIf 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 themappassed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map, String message)
Ensures thatmappassed as an argument is notnullor an empty map.To specify an arbitrary exception object, use the
requireNonEmpty(Map, RuntimeException)method. Themessagepassed 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"); >> NullPointerExceptionIf 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"); >> PreconditionFailedExceptionIf 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 themappassed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Map<?,?> map, RuntimeException exception)
Ensures thatmappassed as an argument is notnullor an empty map.If
mapis an empty map, any exception object passed as an argument will be returned. Executed by therequireNonEmpty(Map)method, if themappassed as argument is an empty map, throwsPreconditionFailedExceptionas 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()); >> NullPointerExceptionIf the map argument is an empty map, any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(Map.of(), new AnyRuntimeException()); >> AnyRuntimeExceptionIf 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- Ifmappassed as an argument isnull, or if any exception object passed as an argument isnullPreconditionFailedException- If themapargument is an empty map
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set)
Ensures thatsetpassed as an argument is notnullor 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); >> NullPointerExceptionPreconditionFailedException will be thrown if the set passed as an argument is an empty set.
Preconditions.requireNonEmpty(Set.of()); >> PreconditionFailedExceptionIf 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 thesetpassed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set, String message)
Ensures thatsetpassed as an argument is notnullor an empty set.To specify an arbitrary exception object, use the
requireNonEmpty(Set, RuntimeException)method. Themessagepassed 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"); >> NullPointerExceptionIf 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"); >> PreconditionFailedExceptionIf 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 thesetpassed as an argument does not contain any elements
-
requireNonEmpty
public static void requireNonEmpty(Set<?> set, RuntimeException exception)
Ensures thatsetpassed as an argument is notnullor an empty set.If
setis an empty set, any exception object passed as an argument will be returned. Executed by therequireNonEmpty(Set)method, if thesetpassed as argument is an empty set, throwsPreconditionFailedExceptionas 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()); >> NullPointerExceptionIf the set argument is an empty set, any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(Set.of(), new AnyRuntimeException()); >> AnyRuntimeExceptionIf 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- Ifsetpassed as an argument isnull, or if any exception object passed as an argument isnullPreconditionFailedException- If thesetargument is an empty set
-
requireNonEmpty
public static void requireNonEmpty(Object[] array)
Ensures that the array passed as an argument is notnullor an empty array.Throws
PreconditionFailedExceptionif the argument is eithernullor 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); >> NullPointerExceptionPreconditionFailedException will be thrown if the array argument is an empty array.
Preconditions.requireNonEmpty(new String[] {}); >> PreconditionFailedExceptionIf 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 isnullPreconditionFailedException- 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 notnullor an empty array.Throws
PreconditionFailedExceptionif the array argument isnullor an empty array. Themessagepassed 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"); >> NullPointerExceptionPreconditionFailedException 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"); >> PreconditionFailedExceptionIf 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 isnullPreconditionFailedException- 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 notnullor 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 throwPreconditionFailedExceptionif 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()); >> NullPointerExceptionIf the array argument is an empty array, then any exception object passed as an argument will be thrown.
Preconditions.requireNonEmpty(new String[] {}, new AnyRuntimeException()); >> AnyRuntimeExceptionIf 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 isnullor if the exception object passed as an argument isnullPreconditionFailedException- 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,PreconditionFailedExceptionwill 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"); >> PreconditionFailedExceptionIf 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, thenPreconditionFailedExceptionwill be thrown at runtime as an exception object. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 byprefixat the specified search start point.If the argument does not begin with a prefix specified by
prefix,PreconditionFailedExceptionwill 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); >> PreconditionFailedExceptionIf 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 byprefixfrom 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 byprefixat the specified search start point.If the argument doesn't start with a prefix specified by
prefix, thenPreconditionFailedExceptionwill be thrown at runtime as an exception object. Themessagepassed 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"); >> PreconditionFailedExceptionIf 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 byprefixat 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()); >> AnyRuntimeExceptionIf 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 byprefixat 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()); >> AnyRuntimeExceptionIf 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, thenPreconditionFailedExceptionis 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"); >> PreconditionFailedExceptionIf 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,PreconditionFailedExceptionwill be thrown as an exception object at runtime. Anymessagepassed 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"); >> PreconditionFailedExceptionIf 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()); >> AnyRuntimeExceptionIf 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
PreconditionFailedExceptionis thrown.Preconditions.requireTrue(false); >> PreconditionFailedExceptionIf 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,PreconditionFailedExceptionwill be thrown as an exception object at runtime. Anymessagepassed 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
PreconditionFailedExceptionis thrown.Preconditions.requireTrue(false, "any message"); >> PreconditionFailedExceptionIf 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()); >> AnyRuntimeExceptionIf 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
PreconditionFailedExceptionis thrown.Preconditions.requireFalse(true); >> PreconditionFailedExceptionIf 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,PreconditionFailedExceptionwill be thrown as an exception object at runtime. Anymessagepassed 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
PreconditionFailedExceptionis thrown.Preconditions.requireFalse(true, "any message"); >> PreconditionFailedExceptionIf 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()); >> AnyRuntimeExceptionIf 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
-
-