Skip to content

Commit

Permalink
Add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Croway committed Feb 21, 2024
1 parent 371fda9 commit daf0b87
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class XmlFactoryBuilder extends TSFBuilder<XmlFactory, XmlFactoryBuilder>
protected String _nameForTextElement;

/**
* Set a default value in case of empty an empty element (empty XML tag)
* Set a default value in case of an empty element (empty XML tag)
*<p>
* Value used for pseudo-property used for returning empty XML tag.
* Defaults to empty String, but may be changed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ public Builder nameForTextElement(String name) {
return this;
}

/**
*
* Set a default value in case of an empty element (empty XML tag)
*<p>
* In case of an empty XML tag (like `<no-content/>`) the serialized value
* is set to `String value`. If not specified, the default value is empty String.
*
* @since 2.17
*/
public Builder valueForEmptyElement(String value) {
_mapper.setValueForEmptyElement(value);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ public FromXmlParser(IOContext ctxt, int genericParserFeatures, int xmlFeatures,
this(ctxt, genericParserFeatures, xmlFeatures, codec, xmlReader, tagProcessor, FromXmlParser.DEFAULT_EMPTY_ELEMENT_VALUE);
}

/**
* @since 2.17
*/
public FromXmlParser(IOContext ctxt, int genericParserFeatures, int xmlFeatures,
ObjectCodec codec, XMLStreamReader xmlReader, XmlNameProcessor tagProcessor, String valueForEmptyElement)
throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public class XmlTokenStream
*/
protected String _textValue;

protected String _valueForEmptyElement;
protected final String _valueForEmptyElement;

/**
* Marker flag set if caller wants to "push back" current token so
Expand Down Expand Up @@ -558,7 +558,6 @@ private final int _next() throws XMLStreamException

/**
* @return Collected text, if any, EXCEPT that if {@code FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL}
* OR {@code FromXmlParser.Feature.EMPTY_ELEMENT_AS_EMPTY_ARRAY}
* AND empty element, returns {@code null}
*/
private final String _collectUntilTag() throws XMLStreamException
Expand Down

0 comments on commit daf0b87

Please sign in to comment.