Package eu.bitfish.jcf.processor.exception

Examples of eu.bitfish.jcf.processor.exception.FilterException


    try {
      Class<?> clazz = obj.getClass();
      Method meth = clazz.getMethod(method, new Class[] {});
      return meth.invoke(obj, new Object[] {});
    } catch (NoSuchMethodException e) {
      throw new FilterException("Method " + method + " does not exist.",
          e);
    } catch (SecurityException e) {
      throw new FilterException("Method " + method
          + " is not accessible.", e);
    } catch (IllegalAccessException | IllegalArgumentException
        | InvocationTargetException e) {
      throw new FilterException("Unable to execute the method " + method
          + " on object " + obj, e);
    }
  }
View Full Code Here


          && DateUtil.isDate(secondValue)) {
        try {
          return DateUtil.getDate(firstValue).compareTo(
              DateUtil.getDate(secondValue)) == 1;
        } catch (ParseException e) {
          throw new FilterException("Unable to parse date ("
              + firstValue + ", " + secondValue + ")");
        }
      }
      throw new FilterException("Operator > for value " + firstValue
          + " and value " + secondValue + " is not applicable.");
    case ">=":
      if (StringUtils.isNumeric(firstValue)
          && StringUtils.isNumeric(secondValue)) {
        return Double.parseDouble(firstValue) > Double
            .parseDouble(secondValue);
      } else if (DateUtil.isDate(firstValue)
          && DateUtil.isDate(secondValue)) {
        try {
          return DateUtil.getDate(firstValue).compareTo(
              DateUtil.getDate(secondValue)) >= 0;
        } catch (ParseException e) {
          throw new FilterException("Unable to parse date ("
              + firstValue + ", " + secondValue + ")");
        }
      }
      throw new FilterException("Operator >= for value " + firstValue
          + " and value " + secondValue + " is not applicable.");
    case "<":
      if (StringUtils.isNumeric(firstValue)
          && StringUtils.isNumeric(secondValue)) {
        return Double.parseDouble(firstValue) < Double
            .parseDouble(secondValue);
      } else if (DateUtil.isDate(firstValue)
          && DateUtil.isDate(secondValue)) {
        try {
          return DateUtil.getDate(firstValue).compareTo(
              DateUtil.getDate(secondValue)) == -1;
        } catch (ParseException e) {
          throw new FilterException("Unable to parse date ("
              + firstValue + ", " + secondValue + ")");
        }
      }
      throw new FilterException("Operator < for value " + firstValue
          + " and value " + secondValue + " is not applicable.");
    case "<=":
      if (StringUtils.isNumeric(firstValue)
          && StringUtils.isNumeric(secondValue)) {
        return Double.parseDouble(firstValue) < Double
            .parseDouble(secondValue);
      } else if (DateUtil.isDate(firstValue)
          && DateUtil.isDate(secondValue)) {
        try {
          return DateUtil.getDate(firstValue).compareTo(
              DateUtil.getDate(secondValue)) <= 0;
        } catch (ParseException e) {
          throw new FilterException("Unable to parse date ("
              + firstValue + ", " + secondValue + ")");
        }
      }
      throw new FilterException("Operator <= for value " + firstValue
          + " and value " + secondValue + " is not applicable.");
    }

    throw new FilterException("Unkown operator " + _operator);
  }
View Full Code Here

TOP

Related Classes of eu.bitfish.jcf.processor.exception.FilterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.