private String validate(Object obj, Field f) { try { f.setAccessible(true); Object value = f.get(obj); Validation at = f.getAnnotation(Validation.class); if (at.notNull() && value == null) { return error(obj, f, "field can not be null"); } if (at.notZero() && TypeUtils.isTypeOf(value, Integer.TYPE, Integer.class, Long.TYPE, Long.class)) { if (value != null) { long intValue = Long.valueOf(value.toString()); if (intValue == 0) { return error(obj, f, "field can not be zero"); } } } return null; } catch (Exception e) { throw new CloudRuntimeException(e); } }