org.clazzes.remoting.marshal
Class CompactMarshalerFactory

java.lang.Object
  extended by org.clazzes.remoting.marshal.MarshalerFactorySupport
      extended by org.clazzes.remoting.marshal.CompactMarshalerFactory
All Implemented Interfaces:
MarshalerFactory

public class CompactMarshalerFactory
extends MarshalerFactorySupport

A marshaler factory, that emits a marshaler, which serializes a java class in a low-bandwidth consuming manner. The downside of this implementation is, that the marshaler needs to know the serializable classes it knows a priori.

Author:
wglas

Constructor Summary
CompactMarshalerFactory()
          Instantiate a CompactMarshalerFactory with the input and output buffer size set to 1460, the most common MSS for TCP over ethernet.
 
Method Summary
 ObjectResolver getObjectResolver()
           
 boolean isExtendClasses()
           
 boolean isFlattenCollections()
           
 Marshaler newMarshaler()
           
 void registerClass(java.lang.Class<?> c)
           
 void setExtendClasses(boolean extendClasses)
           
 void setExtendedClasses(java.util.List<java.lang.Class<?>> clazzes)
          This setter enables to extend the set of marshalable classes through the spring configuration.
 void setFlattenCollections(boolean flattenCollections)
           
 void setObjectResolver(ObjectResolver objectResolver)
           
 
Methods inherited from class org.clazzes.remoting.marshal.MarshalerFactorySupport
getInputBufferSize, getOutputBufferSize, setInputBufferSize, setOutputBufferSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompactMarshalerFactory

public CompactMarshalerFactory()
Instantiate a CompactMarshalerFactory with the input and output buffer size set to 1460, the most common MSS for TCP over ethernet. extendClasses is set to true, if you change this setting, you might want to register new classes or call setExtendClasses(true).

Method Detail

newMarshaler

public Marshaler newMarshaler()
Specified by:
newMarshaler in interface MarshalerFactory
Specified by:
newMarshaler in class MarshalerFactorySupport
Returns:
A new marshaler instance.

registerClass

public void registerClass(java.lang.Class<?> c)
Parameters:
c - The class to register for marshaling. This is needed, if isExtendClasses() is false.

isExtendClasses

public boolean isExtendClasses()
Returns:
Whether the marshaler dynamically extends the list of marshalable classes.

setExtendClasses

public void setExtendClasses(boolean extendClasses)
Parameters:
extendClasses - Whether the marshaler should dynamically extend the list of marshalable classes.

getObjectResolver

public ObjectResolver getObjectResolver()
Returns:
The object resolver, which intercepts objects being read or written.

setObjectResolver

public void setObjectResolver(ObjectResolver objectResolver)
Parameters:
objectResolver - The object resolver, which intercepts objects being read or written.

isFlattenCollections

public boolean isFlattenCollections()
Returns:
Whether collection are mapped to specialized serializable form. If set to true, all collections are deserialized as ArrayList, HashSet and HashMap respectively.

setFlattenCollections

public void setFlattenCollections(boolean flattenCollections)
Parameters:
flattenCollections - Whether collection are mapped to specialized serializable form.

setExtendedClasses

public void setExtendedClasses(java.util.List<java.lang.Class<?>> clazzes)
This setter enables to extend the set of marshalable classes through the spring configuration. This is needed, if isExtendClasses() is false.

Parameters:
clazzes - A list of clazzes to add to the list of marshalable classes.


Copyright © 2010. All Rights Reserved.