Version 3.10.0

hirondelle.web4j.model
Class ConvertParamImpl

Object
  extended by hirondelle.web4j.model.ConvertParamImpl
All Implemented Interfaces:
ConvertParam

public class ConvertParamImpl
extends Object
implements ConvertParam

Default implementation of ConvertParam.


Constructor Summary
ConvertParamImpl()
           
 
Method Summary
<T> T
convert(String aFilteredInputValue, Class<T> aSupportedTargetClass, Locale aLocale, TimeZone aTimeZone)
          Apply reasonable parsing policies, suitable for most applications.
 String filter(String aRawInputValue)
          Coerce all parameters with no visible content to null.
static String getIgnorableParamValue()
          Return the IgnorableParamValue configured in web.xml.
static void init(ServletConfig aConfig)
          Called by the framework upon startup.
 boolean isSupported(Class<?> aTargetClass)
          Return true only if aTargetClass is supported by this implementation.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertParamImpl

public ConvertParamImpl()
Method Detail

init

public static void init(ServletConfig aConfig)
Called by the framework upon startup.


isSupported

public final boolean isSupported(Class<?> aTargetClass)
Return true only if aTargetClass is supported by this implementation.

The following classes are supported by this implementation as building block classes :

String is supported only when explicitly allowed. The AllowStringAsBuildingBlock setting in web.xml controls whether or not this class allows String as a supported class. By default, its value is FALSE, since SafeText is the recommended replacement for String.

Specified by:
isSupported in interface ConvertParam

filter

public String filter(String aRawInputValue)
Coerce all parameters with no visible content to null.

In addition, any raw input value that matches IgnorableParamValue in web.xml is also coerced to null. See web.xml for more information.

Any non-null result is trimmed. This method can be overridden, if desired.

Specified by:
filter in interface ConvertParam
Parameters:
aRawInputValue - the raw, unchanged parameter value, as submitted in the underlying request.

convert

public final <T> T convert(String aFilteredInputValue,
                           Class<T> aSupportedTargetClass,
                           Locale aLocale,
                           TimeZone aTimeZone)
                throws ModelCtorException
Apply reasonable parsing policies, suitable for most applications.

Roughly, the policies are :

Specified by:
convert in interface ConvertParam
Parameters:
aFilteredInputValue - parameter value as returned by ConvertParam.filter(String)
aSupportedTargetClass - supported target building block class in a Model Object constructor
aLocale - Locale returned by the implementation of LocaleSource
aTimeZone - TimeZone returned by the implementation of TimeZoneSource
Throws:
ModelCtorException

getIgnorableParamValue

public static final String getIgnorableParamValue()
Return the IgnorableParamValue configured in web.xml. See web.xml for more information.


Version 3.10.0

Copyright Hirondelle Systems. Published September 20, 2008 - User Guide - All Docs.