org.jboss.dna.common.text
Class Jsr283Encoder

java.lang.Object
  extended by org.jboss.dna.common.text.Jsr283Encoder
All Implemented Interfaces:
TextDecoder, TextEncoder

@Immutable
public class Jsr283Encoder
extends Object
implements TextEncoder, TextDecoder

Encoder that escapes characters that are not allowed in JCR names. The mapping defined in Section 3.6.3 of the JSR-283 public review document:

Non-JCR character
(Unicode code point)
Private use
Unicode code point
(U+002A) U+F02A
/ (U+002F) U+F02F
: (U+003A) U+F03A
[ (U+005B) U+F05B
] (U+005D) U+F05D
| (U+007C) U+F07C


Constructor Summary
Jsr283Encoder()
           
 
Method Summary
 String decode(String jcrNodeName)
          Return the decoded version of an encoded string
 String encode(String publicName)
          Returns the encoded version of a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jsr283Encoder

public Jsr283Encoder()
Method Detail

encode

public String encode(String publicName)
Returns the encoded version of a string.

Specified by:
encode in interface TextEncoder
Parameters:
publicName - the text with characters that are to be encoded.
Returns:
the text with the characters encoded as required, or null if the supplied text is null
See Also:
TextDecoder.decode(String)

decode

public String decode(String jcrNodeName)
Return the decoded version of an encoded string

Specified by:
decode in interface TextDecoder
Parameters:
jcrNodeName - the encoded text
Returns:
the unecoded form of the text, or null if the supplied node name is also null
See Also:
TextEncoder.encode(String)


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.