@Test public void shouldStoreThePatternForValueAttribute() { regexPattern("abc"); PatternDecorator decorator = new PatternDecorator(constraintAttributes); Set<Map.Entry<String, Object>> decoratedEntries = decorator.entrySet(); assertThat(firstKeyFrom(decoratedEntries), is("value")); }
@Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); }
PatternDecorator extends AbstractConstraintAttributesDecorator { @Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); } }
PatternDecorator extends AbstractConstraintAttributesDecorator { @Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); } PatternDecorator(ConstraintAttributes decoratee); }
PatternDecorator extends AbstractConstraintAttributesDecorator { @Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); } PatternDecorator(ConstraintAttributes decoratee); @Override Set<Map.Entry<String, Object>> entrySet(); }
PatternDecorator extends AbstractConstraintAttributesDecorator { @Override public Set<Map.Entry<String, Object>> entrySet() { Set<Map.Entry<String, Object>> entrySet = getDecoratee().entrySet(); Map<String, Object> result = new HashMap<>(); for (Map.Entry<String, Object> entry : entrySet) { if ("regexp".equals(entry.getKey())) { result.put("value", javaToJavaScriptRegexpPattern(entry)); } else { result.put(entry.getKey(), entry.getValue()); } } return result.entrySet(); } PatternDecorator(ConstraintAttributes decoratee); @Override Set<Map.Entry<String, Object>> entrySet();  }