Class MarkupCoercion

java.lang.Object
com.aoapps.hodgepodge.i18n.MarkupCoercion

public final class MarkupCoercion extends Object
Coerces objects to String compatible with JSP Expression Language (JSP EL) and the Java Standard Taglib (JSTL). Also adds support for seamless output of XML DOM nodes.
Author:
AO Industries, Inc.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    append(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Appendable out)
    Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
    static void
    append(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Appendable out, boolean outOptimized)
    Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
    static void
    append(Object value, MarkupType markupType, Appendable out)
    Appends an object's String representation with markup enabled, supporting streaming for specialized types.
    static void
    append(Object value, MarkupType markupType, Appendable out, boolean outOptimized)
    Appends an object's String representation with markup enabled, supporting streaming for specialized types.
    static void
    write(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Writer out)
    Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
    static void
    write(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Writer out, boolean outOptimized)
    Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
    static void
    write(Object value, MarkupType markupType, Writer out)
    Writes an object's String representation with markup enabled, supporting streaming for specialized types.
    static void
    write(Object value, MarkupType markupType, Writer out, boolean outOptimized)
    Writes an object's String representation with markup enabled, supporting streaming for specialized types.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • write

      public static void write(Object value, MarkupType markupType, Writer out) throws IOException
      Writes an object's String representation with markup enabled, supporting streaming for specialized types.
      Throws:
      IOException
      See Also:
    • write

      public static void write(Object value, MarkupType markupType, Writer out, boolean outOptimized) throws IOException
      Writes an object's String representation with markup enabled, supporting streaming for specialized types.
      Parameters:
      outOptimized - Is out already known to have been passed through Coercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder) (with encoder = null)?
      Throws:
      IOException
      See Also:
    • write

      public static void write(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Writer out) throws IOException
      Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
      Parameters:
      encodeLookupMarkup -

      Does the lookup markup need to be encoded?

      When encodeLookupMarkup = true:

      1. Write markup prefix without encoding
      2. Write any encoder prefix
      3. Write value with encoding
      4. Write any encoder suffix
      5. Write markup suffix without encoding

      When encodeLookupMarkup = false:

      1. Write any encoder prefix
      2. Write markup prefix with encoding
      3. Write value with encoding
      4. Write markup suffix with encoding
      5. Write any encoder suffix

      Value is not used when encoder == null.

      encoder - no encoding performed when null, and values of encodeLookupMarkup and encoderPrefixSuffix are not used.
      encoderPrefixSuffix - This includes the encoder prefix and suffix.

      Value is not used when encoder == null.

      Throws:
      IOException
      See Also:
    • write

      public static void write(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Writer out, boolean outOptimized) throws IOException
      Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
      Parameters:
      encodeLookupMarkup -

      Does the lookup markup need to be encoded?

      When encodeLookupMarkup = true:

      1. Write markup prefix without encoding
      2. Write any encoder prefix
      3. Write value with encoding
      4. Write any encoder suffix
      5. Write markup suffix without encoding

      When encodeLookupMarkup = false:

      1. Write any encoder prefix
      2. Write markup prefix with encoding
      3. Write value with encoding
      4. Write markup suffix with encoding
      5. Write any encoder suffix

      Value is not used when encoder == null.

      encoder - no encoding performed when null, and values of encodeLookupMarkup and encoderPrefixSuffix are not used.
      encoderPrefixSuffix - This includes the encoder prefix and suffix.

      Value is not used when encoder == null.

      outOptimized - Is out already known to have been passed through Coercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)?
      Throws:
      IOException
      See Also:
    • append

      public static void append(Object value, MarkupType markupType, Appendable out) throws IOException
      Appends an object's String representation with markup enabled, supporting streaming for specialized types.
      Throws:
      IOException
      See Also:
    • append

      public static void append(Object value, MarkupType markupType, Appendable out, boolean outOptimized) throws IOException
      Appends an object's String representation with markup enabled, supporting streaming for specialized types.
      Parameters:
      outOptimized - Is out already known to have been passed through Coercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder) (with encoder = null)?
      Throws:
      IOException
      See Also:
    • append

      public static void append(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Appendable out) throws IOException
      Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
      Parameters:
      encodeLookupMarkup -

      Does the lookup markup need to be encoded?

      When encodeLookupMarkup = true:

      1. Write markup prefix without encoding
      2. Write any encoder prefix
      3. Write value with encoding
      4. Write any encoder suffix
      5. Write markup suffix without encoding

      When encodeLookupMarkup = false:

      1. Write any encoder prefix
      2. Write markup prefix with encoding
      3. Write value with encoding
      4. Write markup suffix with encoding
      5. Write any encoder suffix

      Value is not used when encoder == null.

      encoder - no encoding performed when null, and values of encodeLookupMarkup and encoderPrefixSuffix are not used.
      encoderPrefixSuffix - This includes the encoder prefix and suffix.

      Value is not used when encoder == null.

      Throws:
      IOException
      See Also:
    • append

      public static void append(Object value, MarkupType markupType, boolean encodeLookupMarkup, Encoder encoder, boolean encoderPrefixSuffix, Appendable out, boolean outOptimized) throws IOException
      Encodes an object's String representation with markup enabled using the provided encoder, supporting streaming for specialized types.
      Parameters:
      encodeLookupMarkup -

      Does the lookup markup need to be encoded?

      When encodeLookupMarkup = true:

      1. Write markup prefix without encoding
      2. Write any encoder prefix
      3. Write value with encoding
      4. Write any encoder suffix
      5. Write markup suffix without encoding

      When encodeLookupMarkup = false:

      1. Write any encoder prefix
      2. Write markup prefix with encoding
      3. Write value with encoding
      4. Write markup suffix with encoding
      5. Write any encoder suffix

      Value is not used when encoder == null.

      encoder - no encoding performed when null, and values of encodeLookupMarkup and encoderPrefixSuffix are not used.
      encoderPrefixSuffix - This includes the encoder prefix and suffix.

      Value is not used when encoder == null.

      outOptimized - Is out already known to have been passed through Coercion.optimize(java.io.Writer, com.aoapps.lang.io.Encoder)?
      Throws:
      IOException
      See Also: