Class StringAdapter

All Implemented Interfaces:
AdapterNode, Element, Node

public class StringAdapter extends AbstractAdapterElement

StringAdapter adapts a Java String value to a DOM Element with the specified property name containing the String's text. e.g. a property String getFoo() { return "My Text!"; } will appear in the result DOM as: <foo>MyText!</foo>

Subclasses may override the getStringValue() method in order to use StringAdapter as a simplified custom XML adapter for Java types.

  • Constructor Details

  • Method Details

    • getStringValue

      protected String getStringValue()
      Get the object to be adapted as a String value.

      This method can be overridden by subclasses that wish to use StringAdapter as a simplified customizable XML adapter for Java types.

      Returns:
      the string value
    • buildChildAdapters

      protected List<Node> buildChildAdapters()
      Description copied from class: AbstractAdapterNode
      subclasses override to produce their children
      Overrides:
      buildChildAdapters in class AbstractAdapterNode
      Returns:
      List of child adapters.
    • getParseStringAsXML

      @Deprecated(forRemoval=true, since="7.2.0") public boolean getParseStringAsXML()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This feature has been removed for security reasons (potential XML Entity Expansion attacks). This method now always returns false and will be removed in a future version.
      Returns:
      always returns false
    • setParseStringAsXML

      @Deprecated(forRemoval=true, since="7.2.0") public void setParseStringAsXML(boolean parseStringAsXML)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This feature has been removed for security reasons (potential XML Entity Expansion attacks). This method is now a no-op and will be removed in a future version.
      Parameters:
      parseStringAsXML - ignored