com.informix.json

## Class ClassMapBasedObjectSerializer

- java.lang.Object
- - com.informix.json.AbstractObjectSerializer
  - - com.informix.json.ClassMapBasedObjectSerializer

All Implemented Interfaces:
  ObjectSerializer

    public class ClassMapBasedObjectSerializer
    extends AbstractObjectSerializer

Objects of type ClassMapBasedObjectSerializer are constructed to perform instance specific object to JSON serialization schemes.

This class is not thread safe

### Constructor Summary

Constructors
Constructor and Description
`ClassMapBasedObjectSerializer()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addObjectSerializer(java.lang.Class<?> c, ObjectSerializer serializer)` Assign a ObjectSerializer to perform a type specific serialization scheme
`void` `serialize(java.lang.Object obj, java.lang.StringBuilder buf)` Serializes `obj` into `buf`.

### Methods inherited from class com.informix.json.AbstractObjectSerializer

`serialize`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ClassMapBasedObjectSerializer

    public ClassMapBasedObjectSerializer()

### Method Detail

#### addObjectSerializer

    public void addObjectSerializer(java.lang.Class<?> c,
                                    ObjectSerializer serializer)

Assign a ObjectSerializer to perform a type specific serialization scheme

Parameters:
  `c` - this object's type serves as a key in the serialization map. ClassMapBasedObjectSerializer uses org.bson.util.ClassMap and not only checks if 'c' is a key in the Map, but also walks the up superclass and interface graph of 'c' to find matches. This means that it is only necessary assign ObjectSerializers to base classes. @see org.bson.util.ClassMap
  `serializer` - performs the serialization mapping specific to the @param key type

#### serialize

    public void serialize(java.lang.Object obj,
                          java.lang.StringBuilder buf)

Description copied from interface: `ObjectSerializer`
Serializes `obj` into `buf`.

Parameters:
  `obj` - the object to be serialized
  `buf` - StringBuilder containing the JSON representation of the object