| java.lang.Object org.apache.tapestry.ioc.internal.util.Defense
Defense | final public class Defense (Code) | | Static utility methods for defensive programming.
|
Method Summary | |
public static T | cast(Object parameterValue, Class<T> type, String parameterName) Checks that the provided value is not null, and may be cast to the desired type. | public static String | notBlank(String value, String parameterName) Checks that a parameter value is not null and not empty. | public static T | notNull(T value, String parameterName) Checks that a method parameter value is not null, and returns it. |
cast | public static T cast(Object parameterValue, Class<T> type, String parameterName)(Code) | | Checks that the provided value is not null, and may be cast to the desired type.
< Parameters: T - > Parameters: parameterValue - Parameters: type - Parameters: parameterName - throws: IllegalArgumentException - if the value is null, or is not assignable to the indicated type the casted value |
notBlank | public static String notBlank(String value, String parameterName)(Code) | | Checks that a parameter value is not null and not empty.
Parameters: value - value to check (which is returned) Parameters: parameterName - the name of the parameter, used for exception messages the value, trimmed, if non-blank throws: IllegalArgumentException - if the value is null or empty |
notNull | public static T notNull(T value, String parameterName)(Code) | | Checks that a method parameter value is not null, and returns it. This method is used in
situations where some of the parameters to a method are allowed to be null and other's arent.
In that situation, the method will be annotated with
SuppressNullCheck , and the
relevent null checks will occur inside the method implementation.
< Parameters: T - >the value type Parameters: value - the value (which is checked to ensure non-nullness) Parameters: parameterName - the name of the parameter, used for exception messages the value throws: IllegalArgumentException - if the value is null |
|
|