Use dependent property Display Names in documentation
This closes
@@ -609,17 +609,41 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
for (final PropertyDependency dependency : dependencies) {
final Set<String> dependentValues = dependency.getDependentValues();
final String prefix = (capitalizeThe ? "The" : "the") + " <" + dependency.getPropertyDisplayName() + "> Property ";
- final String suffix;
+ String suffix = "";
if (dependentValues == null) {
suffix = "has a value specified.";
- } else if (dependentValues.size() == 1) {
+ } else {
+ PropertyDescriptor dependencyProperty = null;
+ for (PropertyDescriptor prop : properties) {
+ if (prop.getName().equals(dependency.getPropertyName())) {
+ dependencyProperty = prop;
+ break;
+ }
+ }
+ if (null == dependencyProperty) {
+ throw new XMLStreamException("No property was found matching the name '" + dependency.getPropertyName() + "'");
+ }
+ if (dependentValues.size() == 1) {
final String requiredValue = dependentValues.iterator().next();
- suffix = "has a value of \"" + requiredValue + "\".";
+ final List<AllowableValue> allowableValues = dependencyProperty.getAllowableValues();
+ if (allowableValues != null) {
+ for (AllowableValue av : allowableValues) {
+ if (requiredValue.equals(av.getValue())) {
+ suffix = "has a value of \"" + av.getDisplayName() + "\".";
+ break;
+ }
+ }
+ }
} else {
final StringBuilder sb = new StringBuilder("is set to one of the following values: ");
for (final String dependentValue : dependentValues) {
- sb.append("\"").append(dependentValue).append("\", ");
+ for (AllowableValue av : dependencyProperty.getAllowableValues()) {
+ if (dependentValue.equals(av.getValue())) {
+ sb.append("\"").append(av.getDisplayName()).append("\", ");
+ break;
+ }
+ }
}
// Delete the trailing ", "
@@ -627,6 +651,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
suffix = sb.toString();
}
+ }
final String elementName = dependencies.size() > 1 ? "li" : "strong";
writeSimpleElement(xmlStreamWriter, elementName, prefix + suffix);
