Class 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 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\?"
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String decodeValue​(java.lang.String encodedValue)
      Decodes an ObjectName value that was encoded with the ObjectNameEncoder.encodeValue(String) method.
      java.lang.String encodeValue​(java.lang.String value)
      Encodes the specified value so that it can be included within an ObjectName.
      • Methods inherited from class java.lang.Object

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

      • DefaultObjectNameEncoder

        public DefaultObjectNameEncoder()
    • 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 interface ObjectNameEncoder
        Parameters:
        value - The value to be encoded.
        Returns:
        The encoded value.
        Throws:
        java.lang.IllegalArgumentException - If the value argument is null.
      • decodeValue

        public java.lang.String decodeValue​(java.lang.String encodedValue)
        Description copied from interface: ObjectNameEncoder

        Decodes an ObjectName value that was encoded with the ObjectNameEncoder.encodeValue(String) method.

        Specified by:
        decodeValue in interface ObjectNameEncoder
        Parameters:
        encodedValue - The value to be decoded.
        Returns:
        The decoded value.
        Throws:
        java.lang.IllegalArgumentException - If the encodedValue argument is null, or if it is an invalid encoded value.