Class TrimWhitespaceAdapter

java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<String,String>
google.registry.xml.TrimWhitespaceAdapter

public class TrimWhitespaceAdapter extends javax.xml.bind.annotation.adapters.XmlAdapter<String,String>
XmlAdapter which trims all whitespace surrounding a String.

This is primarily useful for @XmlValue-annotated fields in JAXB objects, as XML values can commonly be formatted like so:


 <ns:tag>
   XML value here.
 </ns:tag>
 
  • Constructor Details

    • TrimWhitespaceAdapter

      public TrimWhitespaceAdapter()
  • Method Details

    • unmarshal

      @Nullable public String unmarshal(@Nullable String value)
      Specified by:
      unmarshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,String>
    • marshal

      @Nullable public String marshal(@Nullable String str)
      Specified by:
      marshal in class javax.xml.bind.annotation.adapters.XmlAdapter<String,String>