|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.datadictionary.validation.ValidationUtils
public class ValidationUtils
ValidationUtils provides static utility methods for validation processing
Inherited from Kuali Student and adapted extensively
Nested Class Summary | |
---|---|
static class |
ValidationUtils.Result
defines possible result values of a comparison operation |
Constructor Summary | |
---|---|
ValidationUtils()
|
Method Summary | ||
---|---|---|
static String |
buildPath(String attributePath,
String attributeName)
constructs a path by appending the attribute name to the provided path |
|
static boolean |
compareValues(Object fieldValue,
Object whenValue,
DataType dataType,
String operator,
boolean isCaseSensitive,
DateTimeService dateTimeService)
compares the value provided by the user and the one specified by the WhenConstraint |
|
static Object |
convertToDataType(Object value,
DataType dataType,
DateTimeService dateTimeService)
attempts to convert the provided value to the given dataType |
|
static Boolean |
getBoolean(Object o)
converts the provided object into a boolean |
|
static Date |
getDate(Object object,
DateTimeService dateTimeService)
determines whether the provided object is a date and tries to converts non-date values |
|
static Double |
getDouble(Object o)
converts the provided object into a double |
|
static Float |
getFloat(Object o)
converts the provided object into an float |
|
static Integer |
getInteger(Object o)
converts the provided object into an integer |
|
static int |
getLastPathIndex(String attributePath)
Used to get the rightmost index value of an attribute path. |
|
static Long |
getLong(Object o)
converts the provided object into a long |
|
static String[] |
getPathTokens(String fieldPath)
converts a path into an array of its path components |
|
static String |
getString(Object o)
converts the provided object into a string |
|
static boolean |
hasText(String string)
checks whether the string contains non-whitespace characters |
|
static
|
isGreaterThan(T value,
Comparable<T> limit)
checks whether the provided value is greater than the limit given |
|
static
|
isGreaterThanOrEqual(T value,
Comparable<T> limit)
checks whether the provided value is greater than or equal to the limit given |
|
static
|
isLessThan(T value,
Comparable<T> limit)
checks whether the provided value is less than the limit given |
|
static
|
isLessThanOrEqual(T value,
Comparable<T> limit)
checks whether the provided value is greater than the limit given |
|
static boolean |
isNullOrEmpty(Object value)
checks whether the provided object is null or empty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidationUtils()
Method Detail |
---|
public static String buildPath(String attributePath, String attributeName)
attributePath
- - a string representation of specifically which attribute (at some depth) is being accessedattributeName
- - the attribute name
public static int getLastPathIndex(String attributePath)
attributePath
-
public static boolean compareValues(Object fieldValue, Object whenValue, DataType dataType, String operator, boolean isCaseSensitive, DateTimeService dateTimeService)
WhenConstraint
fieldValue
- - the value found in the field specified by a CaseConstraint
's propertyName
whenValue
- - the value specified by a WhenConstraint
dataType
- - the data type of the field which caseConstraint's propertyName refers tooperator
- - the relationship to check between the fieldValue
and the whenValue
isCaseSensitive
- - whether string comparison will be carried out in a case sensitive fashiondateTimeService
- - used to convert strings to dates
public static Integer getInteger(Object o)
o
- - the object to convert
public static Long getLong(Object o)
o
- - the object to convert
public static Float getFloat(Object o)
o
- - the object to convert
public static Double getDouble(Object o)
o
- - the object to convert
public static Date getDate(Object object, DateTimeService dateTimeService) throws IllegalArgumentException
object
- - the object to convert/cast into a datedateTimeService
- - used to convert strings to dates
IllegalArgumentException
public static String getString(Object o)
o
- - the object to convert
public static Boolean getBoolean(Object o)
o
- - the object to convert
public static boolean hasText(String string)
string
-
public static boolean isNullOrEmpty(Object value)
value
- - the object to check
public static Object convertToDataType(Object value, DataType dataType, DateTimeService dateTimeService) throws AttributeValidationException
value
- - the object to convertdataType
- - the data type to convert intodateTimeService
- - used to convert strings to dates
AttributeValidationException
public static <T> ValidationUtils.Result isGreaterThan(T value, Comparable<T> limit)
T
- value
- - the object to checklimit
- - the limit to use
ValidationUtils.Result
public static <T> ValidationUtils.Result isGreaterThanOrEqual(T value, Comparable<T> limit)
T
- value
- - the object to checklimit
- - the limit to use
ValidationUtils.Result
public static <T> ValidationUtils.Result isLessThan(T value, Comparable<T> limit)
T
- value
- - the object to checklimit
- - the limit to use
ValidationUtils.Result
public static <T> ValidationUtils.Result isLessThanOrEqual(T value, Comparable<T> limit)
T
- value
- - the object to checklimit
- - the limit to use
ValidationUtils.Result
public static String[] getPathTokens(String fieldPath)
fieldPath
- - a string representation of specifically which attribute (at some depth) is being accessed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |