/** * Interrogates a PropertyDescriptor to get a list of AllowableValues, if * there are none, nothing is written to the stream. * * @param xmlStreamWriter the stream writer to use * @param property the property to describe * @throws XMLStreamException thrown if there was a problem writing to the * XML Stream */ protected void writeValidValues(XMLStreamWriter xmlStreamWriter, PropertyDescriptor property) throws XMLStreamException { if (property.getAllowableValues() != null && property.getAllowableValues().size() > 0) { xmlStreamWriter.writeStartElement("ul"); for (AllowableValue value : property.getAllowableValues()) { xmlStreamWriter.writeStartElement("li"); xmlStreamWriter.writeCharacters(value.getDisplayName()); if (value.getDescription() != null) { writeValidValueDescription(xmlStreamWriter, value.getDescription()); } xmlStreamWriter.writeEndElement(); } xmlStreamWriter.writeEndElement(); } }
/** * Interrogates a PropertyDescriptor to get a list of AllowableValues, if * there are none, nothing is written to the stream. * * @param property the property to describe * @throws XMLStreamException thrown if there was a problem writing to the * XML Stream */ protected void writeValidValues(JsonGenerator generator, PropertyDescriptor property) throws IOException { if (property.getAllowableValues() != null && property.getAllowableValues().size() > 0) { for (AllowableValue value : property.getAllowableValues()) { generator.writeStringField(value.getDisplayName(), value.getDescription()); } } }
/** * Interrogates a PropertyDescriptor to get a list of AllowableValues, if * there are none, nothing is written to the stream. * * @param rstWriter the stream writer to use * @param property the property to describe * @throws XMLStreamException thrown if there was a problem writing to the * XML Stream */ protected void writeValidValues(RstPrintWriter rstWriter, PropertyDescriptor property){ if (property.getAllowableValues() != null && property.getAllowableValues().size() > 0) { boolean first = true; for (AllowableValue value : property.getAllowableValues()) { if (!first) { rstWriter.print(", "); } else { first = false; } rstWriter.print(value.getDisplayName()); if (value.getDescription() != null) { writeValidValueDescription(rstWriter, " (" + value.getDescription() + ")"); } } } }