|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objecthirondelle.web4j.model.ConvertParamImpl
public class ConvertParamImpl
Default implementation of ConvertParam
.
Constructor Summary | |
---|---|
ConvertParamImpl()
|
Method Summary | ||
---|---|---|
|
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. |
|
String |
getIgnorableParamValue()
Return the IgnorableParamValue configured in web.xml. |
|
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 |
---|
public ConvertParamImpl()
Method Detail |
---|
public final boolean isSupported(Class<?> aTargetClass)
The following classes are supported by this implementation as building block classes:
SafeText
Decimal
Id
DateTime
You are not obliged to use this class to model Locale and TimeZone.
Many will choose to implement them as just another
code table
instead. In this case, your model object constructors would usually take an Id
parameter for these
items, and translate them into a Code
. See the example apps for a demonstration of this technique.
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.
isSupported
in interface ConvertParam
public String filter(String aRawInputValue)
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.
filter
in interface ConvertParam
aRawInputValue
- the raw, unchanged parameter value, as submitted in the underlying request.public final <T> T convert(String aFilteredInputValue, Class<T> aSupportedTargetClass, Locale aLocale, TimeZone aTimeZone) throws ModelCtorException
Roughly, the policies are:
SafeText.SafeText(String)
Integer.Integer(String)
Formats.getDecimalInputFormat()
Formats.getDecimalInputFormat()
Util.parseBoolean(String)
DateConverter.parseEyeFriendlyDateTime(String, Locale)
and DateConverter.parseHandFriendlyDateTime(String, Locale)
DateConverter.parseEyeFriendly(String, Locale, TimeZone)
and DateConverter.parseHandFriendly(String, Locale, TimeZone)
Long.Long(String)
Id.Id(String)
Locale.getAvailableLocales()
and Locale.toString()
, case sensitive.
TimeZone.getAvailableIDs()
, case sensitive.
convert
in interface ConvertParam
aFilteredInputValue
- parameter value as returned by ConvertParam.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
public final String getIgnorableParamValue()
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |