return false;
} else if (obj0 instanceof Boolean || obj1 instanceof Boolean) {
return coerceToBoolean(obj0).equals(coerceToBoolean(obj1));
+ } else if (obj0.getClass().isEnum()) {
+ return obj0.equals(coerceToEnum(obj1, obj0.getClass()));
+ } else if (obj1.getClass().isEnum()) {
+ return obj1.equals(coerceToEnum(obj0, obj1.getClass()));
}
if (isBigDecimalOp(obj0, obj1)) {
BigDecimal bd0 = (BigDecimal) coerceToNumber(obj0, BigDecimal.class);
return obj0.equals(obj1);
}
}
+
+ /**
+ * @param obj
+ * @param type
+ * @return
+ */
+ public final static Enum coerceToEnum(final Object obj, Class type) {
+ if (obj == null || "".equals(obj)) {
+ return null;
+ }
+ if (obj.getClass().isEnum()) {
+ return (Enum) obj;
+ }
+ return Enum.valueOf(type, obj.toString());
+ }
/**
* @param obj
return "";
} else if (obj instanceof String) {
return (String) obj;
+ } else if (obj instanceof Enum) {
+ return ((Enum) obj).name();
} else {
return obj.toString();
}
if (obj != null && type.isAssignableFrom(obj.getClass())) {
return obj;
}
+ if (type.isEnum()) {
+ return coerceToEnum(obj, type);
+ }
// new to spec
if (obj == null)
if (reload) {
tagHandlerClass = ctxt.load();
+ reload = false;
}
} catch (FileNotFoundException ex) {
throw new JasperException(ex);
* Get a list of files that the current page has source dependency on.
*/
public java.util.List getDependants() {
- try {
- Object target;
- if (isTagFile) {
+ try {
+ Object target;
+ if (isTagFile) {
if (reload) {
tagHandlerClass = ctxt.load();
+ reload = false;
}
- target = tagHandlerClass.newInstance();
- } else {
- target = getServlet();
- }
- if (target != null && target instanceof JspSourceDependent) {
- return ((java.util.List) ((JspSourceDependent) target).getDependants());
- }
- } catch (Throwable ex) {
- }
- return null;
+ target = tagHandlerClass.newInstance();
+ } else {
+ target = getServlet();
+ }
+ if (target != null && target instanceof JspSourceDependent) {
+ return ((java.util.List) ((JspSourceDependent) target).getDependants());
+ }
+ } catch (Throwable ex) {
+ }
+ return null;
}
public boolean isTagFile() {