|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConvertParam
Convert request parameters into common 'building block' objects.
See BuildImpl
for important information on how this item is configured.
BuildImpl.forConvertParam()
returns the configured implementation of this interface.
isSupported(Class)
defines which classes are supported as
building block classes, and convert(String, Class, Locale, TimeZone)
defines
how to construct them from request parameters.
ConvertParamImpl
is provided as a default implementation, and is likely
suitable for many applications.
In addition, implementations may optionally choose to apply universal pre-processing
for Strings. For example, an implementation may decide to trim all Strings, or to force capitalization for
all Strings. Such policies may be centralized here, by including them in the implementation of
filter(String)
or convert(String, Class, Locale, TimeZone)
.
Method Summary | ||
---|---|---|
|
convert(String aFilteredParamValue,
Class<T> aSupportedTargetClass,
Locale aLocale,
TimeZone aTimeZone)
Convert a request parameter value into a building block object. |
|
String |
filter(String aRawParamValue)
Apply a policy for parameter values which are null, empty, or equal to IgnorableParamValue in web.xml. |
|
boolean |
isSupported(Class<?> aTargetClass)
Determine if aTargetClass is a supported building block class. |
Method Detail |
---|
boolean isSupported(Class<?> aTargetClass)
If aTargetClass is supported, then an underlying request parameter can be converted into an object of that class.
The framework will always call this method first, before calling the other methods in this interface.
String filter(String aRawParamValue)
When a 'blank' form is submitted, items are not treated in a uniform manner. For example, a popular browser exhibits this behavior :
Moreover, the W3C spec seems to allow for some ambiguity in what exactly is posted, so the above behavior may not be seen for all browsers.
This method is used to impose uniformity upon all such 'blank' items.
This method can return null. Any non-null values returned by this method must have content. (That is, an implementation cannot return a String which, when trimmed, is empty.)
aRawParamValue
- the raw, unchanged parameter value, as submitted in the underlying request.<T> T convert(String aFilteredParamValue, Class<T> aSupportedTargetClass, Locale aLocale, TimeZone aTimeZone) throws ModelCtorException
The value passed to this method is first filtered, using filter(String)
.
Implementations must throw a ModelCtorException
when a parsing problem occurs.
aFilteredParamValue
- parameter value as returned by filter(String)
aSupportedTargetClass
- supported target building block class in a Model Object constructoraLocale
- Locale
returned by the implementation of LocaleSource
aTimeZone
- TimeZone
returned by the implementation of TimeZoneSource
ModelCtorException
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |