@Test public void multipleValidations() { class MyTextPM extends TextPM { public MyTextPM() { setMandatory(true); PMManager.setup(this); } @Validation(message = "contains no x") boolean containsX() { return getText().indexOf('x') >= 0; } @Validation(message = "contains no y") boolean containsY() { return getText().indexOf('y') >= 0; } } MyTextPM pModel = new MyTextPM(); assertEquals("pModel.isValid()", false, pModel.isValid()); pModel.setText("x"); assertEquals("pModel.isValid()", false, pModel.isValid()); pModel.setText("xy"); 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);  }