com.serotonin.m2m2.module
Class DwrConversionDefinition

java.lang.Object
  extended by com.serotonin.m2m2.module.ModuleElementDefinition
      extended by com.serotonin.m2m2.module.DwrConversionDefinition

public abstract class DwrConversionDefinition
extends ModuleElementDefinition

A DWR conversion definition determines how Java objects will be converted to Javascript objects and vice versa. Most conversions is done by a "bean" converter (using get/is and set methods), and this is typically sufficient for nearly all purposes. By default classes are not allowed to be converted, so any classes that should be allowed need to be explicitly declared.

Author:
Matthew Lohbihler

Constructor Summary
DwrConversionDefinition()
           
 
Method Summary
 void addConversion(java.lang.Class<?> clazz)
          Declares that objects of the given class are allowed to be converted using a bean converter.
 void addConversion(java.lang.Class<?> clazz, java.lang.String converterType)
          Declares that objects of the given class are allowed to be converted using the given converter type.
abstract  void addConversions()
           
 void addConversionWithExclusions(java.lang.Class<?> clazz, java.lang.String exclusions)
          Declares that objects of the given class are allowed to be converted using a bean converter.
 void addConversionWithInclusions(java.lang.Class<?> clazz, java.lang.String inclusions)
          Declares that objects of the given class are allowed to be converted using a bean converter.
 java.util.List<com.serotonin.m2m2.web.dwr.util.DwrClassConversion> getConversions()
           
 void initialize()
           
 
Methods inherited from class com.serotonin.m2m2.module.ModuleElementDefinition
getModule, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DwrConversionDefinition

public DwrConversionDefinition()
Method Detail

initialize

public void initialize()
Overrides:
initialize in class ModuleElementDefinition

addConversions

public abstract void addConversions()

addConversion

public void addConversion(java.lang.Class<?> clazz)
Declares that objects of the given class are allowed to be converted using a bean converter. All available properties of the class are to be converted.

Parameters:
clazz - the class to allow

addConversion

public void addConversion(java.lang.Class<?> clazz,
                          java.lang.String converterType)
Declares that objects of the given class are allowed to be converted using the given converter type.

Parameters:
clazz - the class to allow
converterType - the converter type with which to convert

addConversionWithInclusions

public void addConversionWithInclusions(java.lang.Class<?> clazz,
                                        java.lang.String inclusions)
Declares that objects of the given class are allowed to be converted using a bean converter. Only the given properties of the class are to be converted.

Parameters:
clazz - the class to allow
inclusions - a comma-delimited list of properties to convert

addConversionWithExclusions

public void addConversionWithExclusions(java.lang.Class<?> clazz,
                                        java.lang.String exclusions)
Declares that objects of the given class are allowed to be converted using a bean converter. The given properties of the class are to be excluded from conversion.

Parameters:
clazz - the class to allow
exclusions - a comma-delimited list of properties to exclude

getConversions

public java.util.List<com.serotonin.m2m2.web.dwr.util.DwrClassConversion> getConversions()
Returns:
a list of all conversions provided by this definition