Package org.red5.io.object
Class Serializer
java.lang.Object
org.red5.io.object.Serializer
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getClassName
(Class<?> objectClass) Handles classes by name, also provides "shortened" class aliases where appropriate.static void
Serializes output to a core data type objectstatic void
Serializes output to a core data type objectstatic boolean
serializeField
(String keyName, Field field, Method getter) Checks whether the field should be serialized or notprotected static boolean
writeArrayType
(Output out, Object arrType) Writes array (or collection) out as output Arrays, Collections, etcprotected static boolean
writeBasic
(Output out, Object basic) Writes a primitive out as an objectstatic boolean
writeComplex
(Output out, Object complex) Writes a complex type object outprotected static boolean
writeCustomType
(Output out, Object obj) Writes a custom data to the outputprotected static void
writeDocument
(Output out, Document doc) Writes a document to the outputprotected static void
writeIterator
(Output out, Iterator<Object> it) Writes an iterator out to the outputprotected static void
Writes a List out as an Objectprotected static boolean
writeListType
(Output out, Object listType) Writes Lists out as a data typeprotected static boolean
writeObjectType
(Output out, Object obj) Write typed object to the outputprotected static boolean
writeXMLType
(Output out, Object xml) Writes an xml type out to the output
-
Field Details
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
Serializer
private Serializer()
-
-
Method Details
-
serialize
Serializes output to a core data type object- Parameters:
out
- Output writerany
- Object to serialize
-
serialize
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
Writes a primitive out as an object- Parameters:
out
- Output writerbasic
- Primitive- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeComplex
Writes a complex type object out- Parameters:
out
- Output writercomplex
- Complex datatype object- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeListType
Writes Lists out as a data type- Parameters:
out
- Output writelistType
- List type- Returns:
- boolean true if object was successfully serialized, false otherwise
-
writeList
Writes a List out as an Object- Parameters:
out
- Output writerlist
- List to write as Object
-
writeArrayType
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
Writes an iterator out to the output- Parameters:
out
- Output writerit
- Iterator to write
-
writeXMLType
Writes an xml type out to the output- Parameters:
out
- Output writerxml
- XML- Returns:
- boolean true if object was successfully written, false otherwise
-
writeDocument
Writes a document to the output- Parameters:
out
- Output writerdoc
- Document to write
-
writeObjectType
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
Writes a custom data to the output- Parameters:
out
- Output writerobj
- Custom data- Returns:
- true if the object has been written, otherwise false
-
serializeField
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
-
getClassName
Handles classes by name, also provides "shortened" class aliases where appropriate.- Parameters:
objectClass
- class- Returns:
- class name for given object
-