com.h3c.util.codec

## Class ClassNameCodec

- java.lang.Object
- - com.h3c.util.codec.StringSetCodec
  - - com.h3c.util.codec.EntropicStringSetCodec
    - - com.h3c.util.codec.ClassNameCodec

- All Implemented Interfaces:
    Encodable, EntropicStringCodec, StringCodec

      public class ClassNameCodec
      extends EntropicStringSetCodec

  This class is a specialization of `EntropicStringSetCodec` that is tailored specifically for mapping (fully qualified) class names.
  See Also:
    `CodecFactory`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Class<?> cls)` Convenience method to add the class name of the given class to the mappings.
    `void` | `add(Object o)` Convenience method to add the class name of the class of the given object to the mappings.
    `String` | `encode(Class<?> cls)` Convenience method to return the encoded value for the given class.
    `String` | `encode(Object o)` Convenience method to return the encoded value of the class of the given object.

    - ### Methods inherited from class com.h3c.util.codec.EntropicStringSetCodec

      `add, addAll`

    - ### Methods inherited from class com.h3c.util.codec.StringSetCodec

      `decode, encode, equals, hashCode, size, toDebugString, toEncodedString, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.h3c.util.codec.StringCodec

      `decode, encode, size`

- - ### Method Detail

    - #### add

          public void add(Class<?> cls)

      Convenience method to add the class name of the given class to the mappings. null is silently ignored.
      Parameters:
        `cls` - the class

    - #### add

          public void add(Object o)

      Convenience method to add the class name of the class of the given object to the mappings. null is silently ignored.
      Parameters:
        `o` - the object instance whose class name should be added

    - #### encode

          public String encode(Class<?> cls)

      Convenience method to return the encoded value for the given class.
      Parameters:
        `cls` - the class to encode
      Returns:
        the encoded value

    - #### encode

          public String encode(Object o)

      Convenience method to return the encoded value of the class of the given object.
      Parameters:
        `o` - the object whose class should be encoded
      Returns:
        the encoded value

Copyright © 2014. All Rights Reserved.