## org.red5.io.object
Class Serializer

    java.lang.Object
      org.red5.io.object.Serializer

    public class Serializer

extends Object

The Serializer class writes data output and handles the data according to the core data types

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard, Codegent Ltd (luke@codegent.com), Harald Radi (harald.radi@nme.at)

Field Summary
`protected static Logger` `log` Logger

Constructor Summary
`Serializer()`

Method Summary
`String` `getClassName(Class<?> objectClass)`
`Object` `preProcessExtension(Object any)` Pre processes an object TODO // must be implemented
`void` `serialize(Output out, Field field, Method getter, Object object, Object value)` Serializes output to a core data type object
`void` `serialize(Output out, Object any)` Serializes output to a core data type object
`boolean` `serializeField(String keyName, Field field, Method getter)` Checks whether the field should be serialized or not
`protected boolean` `writeArrayType(Output out, Object arrType)` Writes array (or collection) out as output Arrays, Collections, etc
`protected boolean` `writeBasic(Output out, Object basic)` Writes a primitive out as an object
`boolean` `writeComplex(Output out, Object complex)` Writes a complex type object out
`protected boolean` `writeCustomType(Output out, Object obj)` Writes a custom data to the output
`protected void` `writeDocument(Output out, Document doc)` Writes a document to the output
`protected void` `writeIterator(Output out, Iterator<Object> it)` Writes an iterator out to the output
`protected void` `writeList(Output out, List<?> list)` Writes a List out as an Object
`protected boolean` `writeListType(Output out, Object listType)` Writes Lists out as a data type
`protected boolean` `writeObjectType(Output out, Object obj)` Write typed object to the output
`protected boolean` `writeXMLType(Output out, Object xml)` Writes an xml type out to the output

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Logger log

  Logger

Constructor Detail

### Serializer

    public Serializer()

Method Detail

### serialize

    public void serialize(Output out,
                          Object any)

  Serializes output to a core data type object

  Parameters:
    `out` - Output writer
    `any` - Object to serialize

### serialize

    public void serialize(Output out,
                          Field field,
                          Method getter,
                          Object object,
                          Object value)

  Serializes output to a core data type object

  Parameters:
    `out` - Output writer
    `field` - The field to serialize
    `getter` - The getter method if not a field
    `object` - Parent object
    `value` - Object to serialize

### writeBasic

    protected boolean writeBasic(Output out,
                                 Object basic)

  Writes a primitive out as an object

  Parameters:
    `out` - Output writer
    `basic` - Primitive
  Returns:
    boolean true if object was successfully serialized, false otherwise

### writeComplex

    public boolean writeComplex(Output out,
                                Object complex)

  Writes a complex type object out

  Parameters:
    `out` - Output writer
    `complex` - Complex datatype object
  Returns:
    boolean true if object was successfully serialized, false otherwise

### writeListType

    protected boolean writeListType(Output out,
                                    Object listType)

  Writes Lists out as a data type

  Parameters:
    `out` - Output write
    `listType` - List type
  Returns:
    boolean true if object was successfully serialized, false otherwise

### writeList

    protected void writeList(Output out,
                             List<?> list)

  Writes a List out as an Object

  Parameters:
    `out` - Output writer
    `list` - List to write as Object

### writeArrayType

    protected boolean writeArrayType(Output out,
                                     Object arrType)

  Writes array (or collection) out as output Arrays, Collections, etc

  Parameters:
    `out` - Output object
    `arrType` - Array or collection type
  Returns:
    `true` if the object has been written, otherwise `false`

### writeIterator

    protected void writeIterator(Output out,
                                 Iterator<Object> it)

  Writes an iterator out to the output

  Parameters:
    `out` - Output writer
    `it` - Iterator to write

### writeXMLType

    protected boolean writeXMLType(Output out,
                                   Object xml)

  Writes an xml type out to the output

  Parameters:
    `out` - Output writer
    `xml` - XML
  Returns:
    boolean `true` if object was successfully written, `false` otherwise

### writeDocument

    protected void writeDocument(Output out,
                                 Document doc)

  Writes a document to the output

  Parameters:
    `out` - Output writer
    `doc` - Document to write

### writeObjectType

    protected boolean writeObjectType(Output out,
                                      Object obj)

  Write typed object to the output

  Parameters:
    `out` - Output writer
    `obj` - Object type to write
  Returns:
    `true` if the object has been written, otherwise `false`

### preProcessExtension

    public Object preProcessExtension(Object any)

  Pre processes an object TODO // must be implemented

  Parameters:
    `any` - Object to preprocess
  Returns:
    Prerocessed object

### writeCustomType

    protected boolean writeCustomType(Output out,
                                      Object obj)

  Writes a custom data to the output

  Parameters:
    `out` - Output writer
    `obj` - Custom data
  Returns:
    `true` if the object has been written, otherwise `false`

### serializeField

    public boolean serializeField(String keyName,
                                  Field field,
                                  Method getter)

  Checks whether the field should be serialized or not

  Parameters:
    `keyName` - key name
    `field` - The field to be serialized
    `getter` - Getter method for field
  Returns:
    `true` if the field should be serialized, otherwise `false`

### getClassName

    public String getClassName(Class<?> objectClass)

Copyright © 2006-2010 The Red5 Project