org.peaseplate.internal.transformer
Class EncodeTransformers

java.lang.Object
  extended by org.peaseplate.internal.transformer.EncodeTransformers

public class EncodeTransformers
extends java.lang.Object


Constructor Summary
EncodeTransformers()
           
 
Method Summary
 java.lang.String html(RenderContext context, java.lang.Object value)
          Encodes the value using HTML entities.
 java.lang.String html(RenderContext context, java.lang.Object value, boolean encodeCRLF)
          Encodes the value using HTML entities.
 java.lang.String html(RenderContext context, java.lang.Object value, boolean encodeCRLF, boolean encodeSpace, int encodeTabBy)
          Encodes the value using HTML entities
 java.lang.String javaScript(RenderContext context, java.lang.Object value)
          Encodes the value to be used in Javascript strings.
 java.lang.String json(RenderContext context, java.lang.Object value)
          Encodes the value to be used in JSON strings.
 java.lang.String xml(RenderContext context, java.lang.Object value)
          Encodes the value using XML entities
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodeTransformers

public EncodeTransformers()
Method Detail

javaScript

public java.lang.String javaScript(RenderContext context,
                                   java.lang.Object value)
Encodes the value to be used in Javascript strings.

Parameters:
context - the context
value - the value, may be null
Returns:
the encoded value

json

public java.lang.String json(RenderContext context,
                             java.lang.Object value)
Encodes the value to be used in JSON strings.

Parameters:
context - the context
value - the value, may be null
Returns:
the encoded value

xml

public java.lang.String xml(RenderContext context,
                            java.lang.Object value)
Encodes the value using XML entities

Parameters:
context - the context
value - the value, may be null
Returns:
the encoded (or empty) string

html

public java.lang.String html(RenderContext context,
                             java.lang.Object value)
Encodes the value using HTML entities. Encodes encodes CR or LF or CRLF to <br />, does not touch spaces or tabs.

Parameters:
context - the context
value - the value, may be null
Returns:
the encoded (or empty) string

html

public java.lang.String html(RenderContext context,
                             java.lang.Object value,
                             boolean encodeCRLF)
Encodes the value using HTML entities. Does not touch spaces or tabs.

Parameters:
context - the context
value - the value, may be null
encodeCRLF - if set to true, this method encodes CR or LF or CRLF to <br />
Returns:
the encoded (or empty) string

html

public java.lang.String html(RenderContext context,
                             java.lang.Object value,
                             boolean encodeCRLF,
                             boolean encodeSpace,
                             int encodeTabBy)
Encodes the value using HTML entities

Parameters:
context - the context
value - the value, may be null
encodeCRLF - if set to true, this method encodes \r or \n or \r\n to <br />
encodeSpace - if set to true, this method encodes spaces (0x20) to &nbsp;
encodeTabBy - if set to >= 0, this method encodes tabs to the specified amount of &nbsp;
Returns:
the encoded (or empty) string


Copyright © 2008. All Rights Reserved.