Class ObjectNameEncoderAccessor.DefaultObjectNameEncoder
- java.lang.Object
-
- com.caplin.management.jmx.encoder.ObjectNameEncoderAccessor.DefaultObjectNameEncoder
-
- All Implemented Interfaces:
ObjectNameEncoder
- Enclosing class:
- ObjectNameEncoderAccessor
public static class ObjectNameEncoderAccessor.DefaultObjectNameEncoder extends java.lang.Object implements ObjectNameEncoder
Standard
ObjectNameEncoder
that will be used if theObjectNameEncoderAccessor.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 Constructor Description DefaultObjectNameEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
decodeValue(java.lang.String encodedValue)
Decodes anObjectName
value that was encoded with theObjectNameEncoder.encodeValue(String)
method.java.lang.String
encodeValue(java.lang.String value)
Encodes the specified value so that it can be included within anObjectName
.
-
-
-
Method Detail
-
encodeValue
public java.lang.String encodeValue(java.lang.String value)
Description copied from interface:ObjectNameEncoder
Encodes the specified value so that it can be included within an
ObjectName
.- Specified by:
encodeValue
in interfaceObjectNameEncoder
- Parameters:
value
- The value to be encoded.- Returns:
- The encoded value.
- Throws:
java.lang.IllegalArgumentException
- If the value argument isnull
.
-
decodeValue
public java.lang.String decodeValue(java.lang.String encodedValue)
Description copied from interface:ObjectNameEncoder
Decodes an
ObjectName
value that was encoded with theObjectNameEncoder.encodeValue(String)
method.- Specified by:
decodeValue
in interfaceObjectNameEncoder
- Parameters:
encodedValue
- The value to be decoded.- Returns:
- The decoded value.
- Throws:
java.lang.IllegalArgumentException
- If the encodedValue argument isnull
, or if it is an invalid encoded value.
-
-