Class ObjectNameEncoderAccessor.DefaultObjectNameEncoder
- All Implemented Interfaces:
ObjectNameEncoder
- Enclosing class:
- ObjectNameEncoderAccessor
Standard ObjectNameEncoder that will be used if the
ObjectNameEncoderAccessor.OBJECT_NAME_ENCODER_CLASS_PROPERTY_NAME system property is
not set, or if there is a problem with the specified class.
The following character will be encoded/decoded by this class:
,:="*?\
With the exception of a backslash (\), any value that contains any of the
above characters will be encoded.
If a value needs to be encoded it will be places within quotes("). Further to
this, the ", *, ? and \ characters will
be escaped by the backslash (\) character. Note: If a value contains a
backslash character, but none of the other characters listed above, will not need to be
encoded, however if it does need to be encoded, then the backslash character must be escaped.
Decoded/encoded value examples:
| Decoded Value | Encoded Value |
|---|---|
ABC | ABC |
AB=C | "AB=C" |
ABC: | "ABC:" |
A,BC | "A,BC" |
\ABC | \ABC |
\ABC: | "\\ABC:" |
AB"C" | "AB\"C\"" |
AB*C | "AB\*C" |
ABC? | "ABC\?" |
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeValue(String encodedValue) Decodes anObjectNamevalue that was encoded with theObjectNameEncoder.encodeValue(String)method.encodeValue(String value) Encodes the specified value so that it can be included within anObjectName.
-
Constructor Details
-
DefaultObjectNameEncoder
public DefaultObjectNameEncoder()
-
-
Method Details
-
encodeValue
Description copied from interface:ObjectNameEncoderEncodes the specified value so that it can be included within an
ObjectName.- Specified by:
encodeValuein interfaceObjectNameEncoder- Parameters:
value- The value to be encoded.- Returns:
- The encoded value.
- Throws:
IllegalArgumentException- If the value argument isnull.
-
decodeValue
Description copied from interface:ObjectNameEncoderDecodes an
ObjectNamevalue that was encoded with theObjectNameEncoder.encodeValue(String)method.- Specified by:
decodeValuein interfaceObjectNameEncoder- Parameters:
encodedValue- The value to be decoded.- Returns:
- The decoded value.
- Throws:
IllegalArgumentException- If the encodedValue argument isnull, or if it is an invalid encoded value.
-