|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.ops4j.lang.PreConditionException
public class PreConditionException
PreConditionException is used to validate incoming arguments to methods and if not within the supported ranges, throw an appropriate exception describing the problem.
This Exception is used to make the code more robust, and ensure that clients use it as expected.
Constructor Summary | |
---|---|
PreConditionException(java.lang.String message)
PreCondition constructor. |
Method Summary | |
---|---|
static void |
validateEqualTo(double value,
double condition,
java.lang.String identifier)
Validates that the value under test is a particular value. |
static void |
validateEqualTo(long value,
long condition,
java.lang.String identifier)
Validates that the value under test is a particular value. |
static void |
validateEqualTo(java.lang.Number value,
java.lang.Number condition,
java.lang.String identifier)
Validates that the value under test is a particular value. |
static void |
validateGreaterThan(double value,
double limit,
java.lang.String identifier)
Validates that the value is greater than a limit. |
static void |
validateGreaterThan(long value,
long limit,
java.lang.String identifier)
Validates that the value is greater than a limit. |
static void |
validateGreaterThan(java.lang.Number value,
java.lang.Number limit,
java.lang.String identifier)
Validates that the value is greater than a limit. |
static void |
validateLesserThan(double value,
double limit,
java.lang.String identifier)
Validates that the value is lesser than a limit. |
static void |
validateLesserThan(long value,
long limit,
java.lang.String identifier)
Validates that the value is lesser than a limit. |
static void |
validateLesserThan(java.lang.Number value,
java.lang.Number limit,
java.lang.String identifier)
Validates that the value is lesser than a limit. |
static void |
validateNotNull(java.lang.Object object,
java.lang.String identifier)
Validates that the object is not null. |
static void |
validateNull(java.lang.Object object,
java.lang.String identifier)
Validates that the object is null. |
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PreConditionException(java.lang.String message)
message
- The composed error message.Method Detail |
---|
public static void validateNotNull(java.lang.Object object, java.lang.String identifier) throws PreConditionException
object
- The object to be validated.identifier
- The name of the object.
PreConditionException
- if the object is null.public static void validateNull(java.lang.Object object, java.lang.String identifier) throws PreConditionException
object
- The object to be validated.identifier
- The name of the object.
PreConditionException
- if the object is not null.public static void validateGreaterThan(long value, long limit, java.lang.String identifier) throws PreConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateGreaterThan(double value, double limit, java.lang.String identifier) throws PreConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateGreaterThan(java.lang.Number value, java.lang.Number limit, java.lang.String identifier) throws PreConditionException
value > limit
.
identifier
- The name of the object.limit
- The limit that the value must exceed.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateLesserThan(long value, long limit, java.lang.String identifier) throws PreConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateLesserThan(double value, double limit, java.lang.String identifier) throws PreConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateLesserThan(java.lang.Number value, java.lang.Number limit, java.lang.String identifier) throws PreConditionException
value < limit
.
identifier
- The name of the object.limit
- The limit that the value must be smaller than.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateEqualTo(long value, long condition, java.lang.String identifier) throws PreConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateEqualTo(double value, double condition, java.lang.String identifier) throws PreConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PreConditionException
- if the condition is not met.public static void validateEqualTo(java.lang.Number value, java.lang.Number condition, java.lang.String identifier) throws PreConditionException
value == condition
.
identifier
- The name of the object.condition
- The condition value.value
- The value to be tested.
PreConditionException
- if the condition is not met.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |