Class JsUtils


  • public final class JsUtils
    extends java.lang.Object
    $Id: JsUtils.java 1714 2011-09-22 20:38:30Z hielke.hoeve $

    Helper class to ease JavaScript integration.

    Since:
    0.7
    Author:
    Lionel Armanet
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.CharSequence array​(java.lang.CharSequence... args)  
      static java.lang.String doubleQuotes​(java.lang.CharSequence stringToDoubleQuote)
      Double quotes the given string (eg.
      static java.lang.String doubleQuotes​(java.lang.CharSequence stringToDoubleQuote, boolean escapeDoubleQuote)
      Double quotes the given string (eg.
      static java.lang.String escapeDoubleQuote​(java.lang.CharSequence stringToDoubleQuote)  
      static java.lang.String escapeQuote​(java.lang.CharSequence stringToQuote)  
      static java.lang.String implode​(EventLabel... eventLabels)
      Converts the given array of EventLabel to a String.
      static java.lang.String quotes​(java.lang.CharSequence stringToQuote)
      Quotes the given string (eg.
      static java.lang.String quotes​(java.lang.CharSequence stringToQuote, boolean escapeQuote)
      Quotes the given string (eg.
      static java.lang.String string​(int value)
      Converts an int to a String.
      • Methods inherited from class java.lang.Object

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

      • array

        public static java.lang.CharSequence array​(java.lang.CharSequence... args)
        Returns:
        a javascript representation of the array
      • doubleQuotes

        public static java.lang.String doubleQuotes​(java.lang.CharSequence stringToDoubleQuote)
        Double quotes the given string (eg. makes a JavaScript String).
      • doubleQuotes

        public static java.lang.String doubleQuotes​(java.lang.CharSequence stringToDoubleQuote,
                                                    boolean escapeDoubleQuote)
        Double quotes the given string (eg. makes a JavaScript String).
      • escapeDoubleQuote

        public static java.lang.String escapeDoubleQuote​(java.lang.CharSequence stringToDoubleQuote)
        Returns:
        the sequence with escaped double quotes
      • escapeQuote

        public static java.lang.String escapeQuote​(java.lang.CharSequence stringToQuote)
        Returns:
        the sequence with escaped quotes
      • implode

        public static java.lang.String implode​(EventLabel... eventLabels)
        Converts the given array of EventLabel to a String.
      • quotes

        public static java.lang.String quotes​(java.lang.CharSequence stringToQuote)
        Quotes the given string (eg. makes a JavaScript String).
      • quotes

        public static java.lang.String quotes​(java.lang.CharSequence stringToQuote,
                                              boolean escapeQuote)
        Quotes the given string (eg. makes a JavaScript String).
      • string

        public static java.lang.String string​(int value)
        Converts an int to a String. (common alias of valueOf).