@Override public String getDescription(final Locale locale) { final StringBuilder buffer = new StringBuilder(512); buffer.append("The value of this property is a list of ") .append(elementType.getSimpleName()).append(" elements") .append(" [min=").append(occursToString(minOccurs)).append(", max=") .append(occursToString(maxOccurs)).append("]."); buffer.append(" These have to meet"); if (elementConstraints.isEmpty()) { buffer.append(" no constraints."); } else { buffer.append(" the following constraints:"); for (final PropertyConstraint<?> constraint : elementConstraints) { buffer.append("\n - ").append(constraint.getDescription(locale)); } } return buffer.toString(); }
private void addRestrictions(final PropertyDescriptor descriptor) { final List<? extends PropertyConstraint<?>> constraints = descriptor.getConstraints(); if (!constraints.isEmpty()) { final Element valueContraintsElement = new Element("valueConstraints", ns); for (final PropertyConstraint<?> constraint : constraints) { final Element element = new Element("constraint", ns); final String type = constraint.getClass().getName(); addElement(element, "type", type); final String description = htmlUtils.cleanHtmlAndJavadoc(constraint.getDescription()); addElement(element, "description", description); valueContraintsElement.addContent(element); } rootElement.addContent(valueContraintsElement); } }