@Test public void multipleValidationsWithSortOrder() { class MyTextPM extends TextPM { public MyTextPM() { setMandatory(true); PMManager.setup(this); } Integer getInteger() { return Integer.parseInt(getText()); } @Validation(message = "not an integer") @SortOrder(1) boolean isInteger() { try { getInteger(); return true; } catch (NumberFormatException ex) { return false; } } @Validation(message = "number must be even") @SortOrder(2) boolean isEven() { return getInteger() % 2 == 0; } } MyTextPM pModel = new MyTextPM(); assertEquals("pModel.isValid()", false, pModel.isValid()); pModel.setText("13"); assertEquals("pModel.isValid()", false, pModel.isValid()); pModel.setText("12"); assertEquals("pModel.isValid()", true, pModel.isValid()); pModel.setText("bla"); assertEquals("pModel.isValid()", false, pModel.isValid()); }
public void setup(Method method) { if (map.containsKey(method) == false) { ValidationMethodSupport support = support(model, method, resourceBundle); map.put(method, support); } }
ValidationSupport implements Support { public void setup(Method method) { if (map.containsKey(method) == false) { ValidationMethodSupport support = support(model, method, resourceBundle); map.put(method, support); } } }
ValidationSupport implements Support { public void setup(Method method) { if (map.containsKey(method) == false) { ValidationMethodSupport support = support(model, method, resourceBundle); map.put(method, support); } } private  ValidationSupport(PresentationModel model); }
ValidationSupport implements Support { public void setup(Method method) { if (map.containsKey(method) == false) { ValidationMethodSupport support = support(model, method, resourceBundle); map.put(method, support); } } private  ValidationSupport(PresentationModel model); static ValidationSupport get(PresentationModel model); void setup(Method method); }
ValidationSupport implements Support { public void setup(Method method) { if (map.containsKey(method) == false) { ValidationMethodSupport support = support(model, method, resourceBundle); map.put(method, support); } } private  ValidationSupport(PresentationModel model); static ValidationSupport get(PresentationModel model); void setup(Method method);  }