| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ExpressionFunctions |
|
| 2.0;2 |
| 1 | package org.kuali.rice.krad.uif.util; | |
| 2 | ||
| 3 | import org.apache.commons.lang.StringUtils; | |
| 4 | ||
| 5 | /** | |
| 6 | * Defines functions that can be used in el expressions within | |
| 7 | * the UIF dictionary files | |
| 8 | * | |
| 9 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 10 | */ | |
| 11 | 0 | public class ExpressionFunctions { |
| 12 | ||
| 13 | /** | |
| 14 | * Checks whether the given class parameter is assignable from the given object class | |
| 15 | * parameter | |
| 16 | * | |
| 17 | * @param assignableClass - class to use for assignable to | |
| 18 | * @param objectClass - class to use for assignable from | |
| 19 | * @return boolean true if the object class is of type assignable class, false if not | |
| 20 | */ | |
| 21 | public static boolean isAssignableFrom(Class<?> assignableClass, Class<?> objectClass) { | |
| 22 | 0 | return assignableClass.isAssignableFrom(objectClass); |
| 23 | } | |
| 24 | ||
| 25 | /** | |
| 26 | * Checks whether the given value is null or blank string | |
| 27 | * | |
| 28 | * @param value - property value to check | |
| 29 | * @return boolean true if value is null or blank, false if not | |
| 30 | */ | |
| 31 | public static boolean empty(Object value) { | |
| 32 | 0 | return (value == null) || (StringUtils.isBlank(value.toString())); |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 36 | * Returns the name for the given class | |
| 37 | * | |
| 38 | * @param clazz - class object to return name for | |
| 39 | * @return String class name or empty string if class is null | |
| 40 | */ | |
| 41 | public static String getName(Class<?> clazz) { | |
| 42 | 0 | if (clazz == null) { |
| 43 | 0 | return ""; |
| 44 | } else { | |
| 45 | 0 | return clazz.getName(); |
| 46 | } | |
| 47 | } | |
| 48 | } |