org.codehaus.groovy.grails.web.converters.configuration
Class DefaultConverterConfiguration<C extends Converter>

java.lang.Object
  extended by org.codehaus.groovy.grails.web.converters.configuration.DefaultConverterConfiguration<C>
All Implemented Interfaces:
ConverterConfiguration<C>

public class DefaultConverterConfiguration<C extends Converter>
extends java.lang.Object
implements ConverterConfiguration<C>

Mutable Converter Configuration with an priority sorted set of ObjectMarshallers

Since:
1.1

Nested Class Summary
 class DefaultConverterConfiguration.Entry
           
 
Field Summary
static int DEFAULT_PRIORITY
           
 
Constructor Summary
DefaultConverterConfiguration()
           
DefaultConverterConfiguration(ConverterConfiguration<C> delegate)
           
DefaultConverterConfiguration(ConverterConfiguration<C> delegate, org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)
           
DefaultConverterConfiguration(java.util.List<ObjectMarshaller<C>> oms)
           
DefaultConverterConfiguration(java.util.List<ObjectMarshaller<C>> oms, org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)
           
DefaultConverterConfiguration(org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)
           
 
Method Summary
 Converter.CircularReferenceBehaviour getCircularReferenceBehaviour()
          Lookup the configured CircularReferenceBehaviour (how the converter should behave when a circular reference is detected)
 java.lang.String getEncoding()
          Lookup the configured default Character encoding for the Converter
 ObjectMarshaller<C> getMarshaller(java.lang.Object o)
          Lookup the ObjectMarshaller with the highest priority that support to marshall the given object
 java.util.List<ObjectMarshaller<C>> getOrderedObjectMarshallers()
          Retrieve the ordered list of ObjectMarshallers
 org.codehaus.groovy.grails.support.proxy.ProxyHandler getProxyHandler()
          Lookup the ProxyHandler used to deal with proxies instances.
 boolean isPrettyPrint()
          Lookup method whether the converter should default to pretty printed output
 void registerObjectMarshaller(java.lang.Class<?> c, groovy.lang.Closure callable)
           
 void registerObjectMarshaller(java.lang.Class<?> c, int priority, groovy.lang.Closure callable)
           
 void registerObjectMarshaller(ObjectMarshaller<C> marshaller)
           
 void registerObjectMarshaller(ObjectMarshaller<C> marshaller, int priority)
           
 void setCircularReferenceBehaviour(Converter.CircularReferenceBehaviour circularReferenceBehaviour)
           
 void setEncoding(java.lang.String encoding)
           
 void setPrettyPrint(boolean prettyPrint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PRIORITY

public static final int DEFAULT_PRIORITY
See Also:
Constant Field Values
Constructor Detail

DefaultConverterConfiguration

public DefaultConverterConfiguration()

DefaultConverterConfiguration

public DefaultConverterConfiguration(ConverterConfiguration<C> delegate)

DefaultConverterConfiguration

public DefaultConverterConfiguration(org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)

DefaultConverterConfiguration

public DefaultConverterConfiguration(ConverterConfiguration<C> delegate,
                                     org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)

DefaultConverterConfiguration

public DefaultConverterConfiguration(java.util.List<ObjectMarshaller<C>> oms)

DefaultConverterConfiguration

public DefaultConverterConfiguration(java.util.List<ObjectMarshaller<C>> oms,
                                     org.codehaus.groovy.grails.support.proxy.ProxyHandler proxyHandler)
Method Detail

getEncoding

public java.lang.String getEncoding()
Description copied from interface: ConverterConfiguration
Lookup the configured default Character encoding for the Converter

Specified by:
getEncoding in interface ConverterConfiguration<C extends Converter>
Returns:
the Charset name

setEncoding

public void setEncoding(java.lang.String encoding)

getCircularReferenceBehaviour

public Converter.CircularReferenceBehaviour getCircularReferenceBehaviour()
Description copied from interface: ConverterConfiguration
Lookup the configured CircularReferenceBehaviour (how the converter should behave when a circular reference is detected)

Specified by:
getCircularReferenceBehaviour in interface ConverterConfiguration<C extends Converter>
Returns:
an instance of CircularReferenceBehaviour
See Also:
Converter.CircularReferenceBehaviour

isPrettyPrint

public boolean isPrettyPrint()
Description copied from interface: ConverterConfiguration
Lookup method whether the converter should default to pretty printed output

Specified by:
isPrettyPrint in interface ConverterConfiguration<C extends Converter>
Returns:
a boolean

setPrettyPrint

public void setPrettyPrint(boolean prettyPrint)

getOrderedObjectMarshallers

public java.util.List<ObjectMarshaller<C>> getOrderedObjectMarshallers()
Description copied from interface: ConverterConfiguration
Retrieve the ordered list of ObjectMarshallers

Specified by:
getOrderedObjectMarshallers in interface ConverterConfiguration<C extends Converter>
Returns:
the List of ObjectMarshallers ordered by priority

setCircularReferenceBehaviour

public void setCircularReferenceBehaviour(Converter.CircularReferenceBehaviour circularReferenceBehaviour)

registerObjectMarshaller

public void registerObjectMarshaller(ObjectMarshaller<C> marshaller)

registerObjectMarshaller

public void registerObjectMarshaller(ObjectMarshaller<C> marshaller,
                                     int priority)

registerObjectMarshaller

public void registerObjectMarshaller(java.lang.Class<?> c,
                                     int priority,
                                     groovy.lang.Closure callable)

registerObjectMarshaller

public void registerObjectMarshaller(java.lang.Class<?> c,
                                     groovy.lang.Closure callable)

getMarshaller

public ObjectMarshaller<C> getMarshaller(java.lang.Object o)
Description copied from interface: ConverterConfiguration
Lookup the ObjectMarshaller with the highest priority that support to marshall the given object

Specified by:
getMarshaller in interface ConverterConfiguration<C extends Converter>
Parameters:
o - the object which is about to be converted
Returns:
the ObjectMarshaller instance

getProxyHandler

public org.codehaus.groovy.grails.support.proxy.ProxyHandler getProxyHandler()
Description copied from interface: ConverterConfiguration
Lookup the ProxyHandler used to deal with proxies instances.

Specified by:
getProxyHandler in interface ConverterConfiguration<C extends Converter>
Returns:
The proxy handler