/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); if (d.name().startsWith("format.")) { List<Object> attributes = new ArrayList<>(); for (String attr: d.attributes()) { format = Tuple(d.name(), Collections.unmodifiableList(attributes));
if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); if (d.name().startsWith("format.")) { List<Object> attributes = new ArrayList<>(); for (String attr: d.attributes()) { format = Tuple(d.name(), Collections.unmodifiableList(attributes));
if (annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); if (d.name().startsWith("format.")) { List<Object> attributes = new ArrayList<>(); for (String attr: d.attributes()) { format = Tuple(d.name(), Collections.unmodifiableList(attributes));
if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); if(d.name().startsWith("format.")) { List<Object> attributes = new ArrayList<Object>(); for(String attr: d.attributes()) { attributes.add(attrValue); format = Tuple(d.name(), attributes);
if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); if(d.name().startsWith("format.")) { List<Object> attributes = new ArrayList<Object>(); for(String attr: d.attributes()) { attributes.add(attrValue); format = Tuple(d.name(), attributes);
/** * Converts a set of constraints to human-readable values. */ public static List<Tuple<String,List<Object>>> displayableConstraint(Set<ConstraintDescriptor<?>> constraints) { List<Tuple<String,List<Object>>> displayable = new ArrayList<Tuple<String,List<Object>>>(); for(ConstraintDescriptor<?> c: constraints) { Class<?> annotationType = c.getAnnotation().annotationType(); if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); String name = d.name(); List<Object> attributes = new ArrayList<Object>(); Map<String,Object> annotationAttributes = c.getAttributes(); for(String attr: d.attributes()) { attributes.add(annotationAttributes.get(attr)); } displayable.add(Tuple(name, attributes)); } } return displayable; }
/** * Converts a set of constraints to human-readable values. */ public static List<Tuple<String,List<Object>>> displayableConstraint(Set<ConstraintDescriptor<?>> constraints) { List<Tuple<String,List<Object>>> displayable = new ArrayList<Tuple<String,List<Object>>>(); for(ConstraintDescriptor<?> c: constraints) { Class<?> annotationType = c.getAnnotation().annotationType(); if(annotationType.isAnnotationPresent(play.data.Form.Display.class)) { play.data.Form.Display d = annotationType.getAnnotation(play.data.Form.Display.class); String name = d.name(); List<Object> attributes = new ArrayList<Object>(); Map<String,Object> annotationAttributes = c.getAttributes(); for(String attr: d.attributes()) { attributes.add(annotationAttributes.get(attr)); } displayable.add(Tuple(name, attributes)); } } return displayable; }