Class AddressFormatter


  • public class AddressFormatter
    extends Object
    Default formatter for Address and its subclasses.
    • Constructor Detail

      • AddressFormatter

        protected AddressFormatter()
    • Method Detail

      • format

        public void format​(StringBuilder sb,
                           Address address,
                           boolean includeRoute)

        Formats the address as a human readable string, not including the route. The resulting string is intended for display purposes only and cannot be used for transport purposes.

        For example, if the unparsed address was
        <"Joe Cheng"@joecheng.com>
        this method would return
        <Joe Cheng@joecheng.com>
        which is not valid for transport; the local part would need to be re-quoted.

        Parameters:
        includeRoute - true if the route should be included if it exists, false otherwise.
      • encode

        public void encode​(StringBuilder sb,
                           Address address)
        Returns a string representation of this address that can be used for transport purposes. The route is never included in this representation because routes are obsolete and RFC 5322 states that obsolete syntactic forms MUST NOT be generated.
      • format

        public String format​(Mailbox mailbox,
                             boolean includeRoute)
      • format

        public String format​(Group group,
                             boolean includeRoute)