org.apache.myfaces.trinidadinternal.util
Class JsonUtils

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.util.JsonUtils

public final class JsonUtils
extends java.lang.Object

Utilities for writing out JSON notation strings inside XML attribute or text.

Author:
Apache Trinidad team

Method Summary
static void writeBoolean(java.lang.StringBuilder out, boolean value)
          Encodes a boolean in JavaScript Object Notation.
static void writeByte(java.lang.StringBuilder out, byte value)
          Encodes a byte in JavaScript Object Notation.
static void writeChar(java.lang.StringBuilder out, char value, boolean escapeXML)
          Encodes a char in JavaScript Object Notation.
static void writeCollection(java.lang.StringBuilder out, java.util.Collection<?> value, boolean escapeXML)
          Encodes a Collection in JavaScript Object Notation.
static void writeColor(java.lang.StringBuilder out, java.awt.Color color)
           
static void writeDate(java.lang.StringBuilder out, java.util.Date value)
           
static void writeDouble(java.lang.StringBuilder out, double value)
          Encodes a double in JavaScript Object Notation.
static void writeFloat(java.lang.StringBuilder out, float value)
          Encodes a float in JavaScript Object Notation.
static void writeInt(java.lang.StringBuilder out, int value)
          Encodes a int in JavaScript Object Notation.
static void writeLong(java.lang.StringBuilder out, long value)
          Encodes a long in JavaScript Object Notation.
static void writeMap(java.lang.StringBuilder out, java.util.Map<?,?> map, boolean escapeXML)
          Encodes a Map in JavaScript Object Notation.
static void writeObject(java.lang.StringBuilder out, java.lang.Object attrValue, boolean escapeXML)
           
static void writeShort(java.lang.StringBuilder out, short value)
          Encodes a short in JavaScript Object Notation.
static void writeString(java.lang.StringBuilder out, java.lang.CharSequence value, boolean escapeXML)
          Encodes a String in JavaScript Object Notation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeObject

public static void writeObject(java.lang.StringBuilder out,
                               java.lang.Object attrValue,
                               boolean escapeXML)
                        throws java.io.IOException
Throws:
java.io.IOException

writeBoolean

public static void writeBoolean(java.lang.StringBuilder out,
                                boolean value)
                         throws java.io.IOException
Encodes a boolean in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the boolean value
Throws:
java.io.IOException

writeByte

public static void writeByte(java.lang.StringBuilder out,
                             byte value)
                      throws java.io.IOException
Encodes a byte in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the byte value
Throws:
java.io.IOException

writeChar

public static void writeChar(java.lang.StringBuilder out,
                             char value,
                             boolean escapeXML)
                      throws java.io.IOException
Encodes a char in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the char value
Throws:
java.io.IOException

writeCollection

public static void writeCollection(java.lang.StringBuilder out,
                                   java.util.Collection<?> value,
                                   boolean escapeXML)
                            throws java.io.IOException
Encodes a Collection in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the List value
Throws:
java.io.IOException

writeDate

public static void writeDate(java.lang.StringBuilder out,
                             java.util.Date value)
                      throws java.io.IOException
Throws:
java.io.IOException

writeColor

public static void writeColor(java.lang.StringBuilder out,
                              java.awt.Color color)
                       throws java.io.IOException
Throws:
java.io.IOException

writeDouble

public static void writeDouble(java.lang.StringBuilder out,
                               double value)
                        throws java.io.IOException
Encodes a double in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the double value
Throws:
java.io.IOException

writeFloat

public static void writeFloat(java.lang.StringBuilder out,
                              float value)
                       throws java.io.IOException
Encodes a float in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the float value
Throws:
java.io.IOException

writeLong

public static void writeLong(java.lang.StringBuilder out,
                             long value)
                      throws java.io.IOException
Encodes a long in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the long value
Throws:
java.io.IOException

writeInt

public static void writeInt(java.lang.StringBuilder out,
                            int value)
                     throws java.io.IOException
Encodes a int in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the int value
Throws:
java.io.IOException

writeShort

public static void writeShort(java.lang.StringBuilder out,
                              short value)
                       throws java.io.IOException
Encodes a short in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the short value
Throws:
java.io.IOException

writeString

public static void writeString(java.lang.StringBuilder out,
                               java.lang.CharSequence value,
                               boolean escapeXML)
                        throws java.io.IOException
Encodes a String in JavaScript Object Notation.

Parameters:
out - the output buffer
value - the String value
Throws:
java.io.IOException

writeMap

public static void writeMap(java.lang.StringBuilder out,
                            java.util.Map<?,?> map,
                            boolean escapeXML)
                     throws java.io.IOException
Encodes a Map in JavaScript Object Notation.

Parameters:
out - the output buffer
map - the Map value
Throws:
java.io.IOException


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.