Package 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, Luke Hubbard, Codegent Ltd (luke@codegent.com), Harald Radi (harald.radi@nme.at), Paul Gregoire (mondain@gmail.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlog
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetClassName(Class<?> objectClass)Handles classes by name, also provides "shortened" class aliases where appropriate.static voidserialize(Output out, Object any)Serializes output to a core data type objectstatic voidserialize(Output out, Field field, Method getter, Object object, Object value)Serializes output to a core data type objectstatic booleanserializeField(String keyName, Field field, Method getter)Checks whether the field should be serialized or notprotected static booleanwriteArrayType(Output out, Object arrType)Writes array (or collection) out as output Arrays, Collections, etcprotected static booleanwriteBasic(Output out, Object basic)Writes a primitive out as an objectstatic booleanwriteComplex(Output out, Object complex)Writes a complex type object outprotected static booleanwriteCustomType(Output out, Object obj)Writes a custom data to the outputprotected static voidwriteDocument(Output out, Document doc)Writes a document to the outputprotected static voidwriteIterator(Output out, Iterator<Object> it)Writes an iterator out to the outputprotected static voidwriteList(Output out, List<?> list)Writes a List out as an Objectprotected static booleanwriteListType(Output out, Object listType)Writes Lists out as a data typeprotected static booleanwriteObjectType(Output out, Object obj)Write typed object to the outputprotected static booleanwriteXMLType(Output out, Object xml)Writes an xml type out to the output
-
-
-
Method Detail
-
serialize
public static void serialize(Output out, Object any)
Serializes output to a core data type object- Parameters:
out- Output writerany- Object to serialize
-
serialize
public static void serialize(Output out, Field field, Method getter, Object object, Object value)
Serializes output to a core data type object- Parameters:
out- Output writerfield- The field to serializegetter- The getter method if not a fieldobject- Parent objectvalue- Object to serialize
-
writeBasic
protected static boolean writeBasic(Output out, Object basic)
Writes a primitive out as an object- Parameters:
out- Output writerbasic- Primitive- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeComplex
public static boolean writeComplex(Output out, Object complex)
Writes a complex type object out- Parameters:
out- Output writercomplex- Complex datatype object- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeListType
protected static boolean writeListType(Output out, Object listType)
Writes Lists out as a data type- Parameters:
out- Output writelistType- List type- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeList
protected static void writeList(Output out, List<?> list)
Writes a List out as an Object- Parameters:
out- Output writerlist- List to write as Object
-
writeArrayType
protected static boolean writeArrayType(Output out, Object arrType)
Writes array (or collection) out as output Arrays, Collections, etc- Parameters:
out- Output objectarrType- Array or collection type- Returns:
- true if the object has been written, otherwise false
-
writeIterator
protected static void writeIterator(Output out, Iterator<Object> it)
Writes an iterator out to the output- Parameters:
out- Output writerit- Iterator to write
-
writeXMLType
protected static boolean writeXMLType(Output out, Object xml)
Writes an xml type out to the output- Parameters:
out- Output writerxml- XML- Returns:
- boolean true if object was successfully written, false otherwise
-
writeDocument
protected static void writeDocument(Output out, Document doc)
Writes a document to the output- Parameters:
out- Output writerdoc- Document to write
-
writeObjectType
protected static boolean writeObjectType(Output out, Object obj)
Write typed object to the output- Parameters:
out- Output writerobj- Object type to write- Returns:
- true if the object has been written, otherwise false
-
writeCustomType
protected static boolean writeCustomType(Output out, Object obj)
Writes a custom data to the output- Parameters:
out- Output writerobj- Custom data- Returns:
- true if the object has been written, otherwise false
-
serializeField
public static boolean serializeField(String keyName, Field field, Method getter)
Checks whether the field should be serialized or not- Parameters:
keyName- key namefield- The field to be serializedgetter- Getter method for field- Returns:
- true if the field should be serialized, otherwise false
-
-