public class RequestSupportImpl extends Object implements RequestSupport
RequestSupport
implementationModifier and Type | Field and Description |
---|---|
protected Application |
application |
protected org.springframework.core.convert.ConversionService |
conversionService |
protected static String |
CURRENT |
protected Environment |
environment |
protected ExpressionEvaluator |
expressionEvaluator |
protected FieldConversionFactory |
fieldConverter |
protected List<FieldType> |
FILE_TYPES |
protected List<FieldType> |
LIST_TYPES |
protected org.springframework.context.MessageSource |
messageSource |
protected Site |
site |
Constructor and Description |
---|
RequestSupportImpl() |
RequestSupportImpl(org.springframework.core.convert.ConversionService conversionService,
Environment environment,
org.springframework.context.MessageSource messageSource) |
Modifier and Type | Method and Description |
---|---|
void |
addErrorMessage(FieldProcessor fp,
MessageParam messageParam)
Adds an error to the
FieldProcessor using FieldProcessor.addErrorMessage(String) . |
void |
addErrorMessage(FieldProcessor fp,
MessageParam messageParam,
String fieldBinding)
Adds an error to a
FieldDef using
FieldProcessor.addErrorMessage(org.appng.xml.platform.FieldDef, String) . |
void |
afterPropertiesSet() |
boolean |
canConvert(Class<?> sourceType,
Class<?> targetType) |
boolean |
canConvert(org.springframework.core.convert.TypeDescriptor sourceType,
org.springframework.core.convert.TypeDescriptor targetType) |
<T> T |
convert(Object source,
Class<T> target) |
<T> T |
convert(Object source,
Class<T> target,
T defaultValue) |
Object |
convert(Object source,
org.springframework.core.convert.TypeDescriptor sourceType,
org.springframework.core.convert.TypeDescriptor targetType) |
void |
fillBindObject(Object instance,
FieldProcessor fp,
RequestContainer container,
ClassLoader classLoader)
Fills the given
bindobject with the (converted) values provided by a RequestContainer . |
Object |
getBindObject(FieldProcessor fp,
RequestContainer container,
ClassLoader classLoader)
Creates, fills and returns a new bindobject.
|
<T> T |
getDefaultIfNull(T source,
T defaultValue) |
String |
getMessage(String key,
Object... args)
Retrieves a message from the underlying
MessageSource , using the Locale provided by
Environment.getLocale() . |
void |
handleException(FieldProcessor fp,
Exception e)
Handles an
Exception . |
boolean |
isFile(FieldType type) |
boolean |
isListType(FieldType type) |
<T> void |
setPropertyValue(T source,
T target,
String property)
Copies the property from
source to target . |
<T> void |
setPropertyValues(T source,
T target,
MetaData metaData)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEnvironment, getFieldConverter, getMessageSource
protected static final String CURRENT
protected org.springframework.core.convert.ConversionService conversionService
protected org.springframework.context.MessageSource messageSource
protected Environment environment
protected ExpressionEvaluator expressionEvaluator
protected FieldConversionFactory fieldConverter
protected Application application
protected Site site
public RequestSupportImpl()
public RequestSupportImpl(org.springframework.core.convert.ConversionService conversionService, Environment environment, org.springframework.context.MessageSource messageSource)
public final void fillBindObject(Object instance, FieldProcessor fp, RequestContainer container, ClassLoader classLoader) throws BusinessException
RequestSupport
bindobject
with the (converted) values provided by a RequestContainer
. The type
of the bindobject
must match fp.getMetaData().getBindClass()
. The MetaData
's
FieldDef
initions are responsible for which fields are getting filled.fillBindObject
in interface RequestSupport
instance
- the bindobject to fillfp
- the current FieldProcessor
container
- the RequestContainer
used to retrieve the values for filling the bindobjectclassLoader
- the ClassLoader
used to load the bindclassBusinessException
- bindobject
is not assignable from the type returned by
fp.getMetaData().getBindClass()
fp.getMetaData().getBindClass()
can not be
instanciated
public final Object getBindObject(FieldProcessor fp, RequestContainer container, ClassLoader classLoader) throws BusinessException
RequestSupport
fp.getMetaData().getBindClass()
. The MetaData
's FieldDef
initions are responsible for
which fields are getting filled.getBindObject
in interface RequestSupport
fp
- the current FieldProcessor
container
- the RequestContainer
used to retrieve the values for filling the bindobjectclassLoader
- the ClassLoader
used to load the bindclassBusinessException
- if the bindclass could not be loaded, instantiated or initialized, or if an error
occurred during filling the bindobjectRequestSupport.fillBindObject(Object, FieldProcessor, RequestContainer, ClassLoader)
public <T> T getDefaultIfNull(T source, T defaultValue)
public String getMessage(String key, Object... args)
RequestSupport
MessageSource
, using the Locale
provided by
Environment.getLocale()
.getMessage
in interface RequestSupport
key
- the message keyargs
- the message argumentspublic void addErrorMessage(FieldProcessor fp, MessageParam messageParam)
RequestSupport
FieldProcessor
using FieldProcessor.addErrorMessage(String)
.
MessageParam.getMessageKey()
is used for the message key, MessageParam.getMessageArgs()
for the
message arguments.addErrorMessage
in interface RequestSupport
fp
- a FieldProcessor
messageParam
- a MessageParam
MessageParam
public void addErrorMessage(FieldProcessor fp, MessageParam messageParam, String fieldBinding)
RequestSupport
FieldDef
using
FieldProcessor.addErrorMessage(org.appng.xml.platform.FieldDef, String)
.
MessageParam.getMessageKey()
is used for the message key, MessageParam.getMessageArgs()
for the
message arguments.addErrorMessage
in interface RequestSupport
fp
- a FieldProcessor
messageParam
- a MessageParam
fieldBinding
- the binding of the FieldDef
to add the error toMessageParam
public void handleException(FieldProcessor fp, Exception e) throws BusinessException
RequestSupport
Exception
. If the given Exception is a BusinessException
, the very same
BusinessException
is being re-thrown. Otherwise, the Exception
is being wrapped into a new
BusinessException
which is then being thrown.Exception
is a MessageParam
, RequestSupport.addErrorMessage(FieldProcessor, MessageParam)
is being called.handleException
in interface RequestSupport
fp
- a FieldProcessor
e
- an Exception
BusinessException
MessageParam
,
RequestSupport.addErrorMessage(FieldProcessor, MessageParam)
public <T> void setPropertyValues(T source, T target, MetaData metaData)
RequestSupport
setPropertyValues
in interface RequestSupport
source
- the source object to read the fields fromtarget
- the target object to write the fields tometaData
- the MetaData
public <T> void setPropertyValue(T source, T target, String property)
RequestSupport
source
to target
.setPropertyValue
in interface RequestSupport
source
- the source object to read the property fromtarget
- the target object to write the property toproperty
- the name of the property to setpublic boolean canConvert(Class<?> sourceType, Class<?> targetType)
canConvert
in interface org.springframework.core.convert.ConversionService
public boolean canConvert(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
canConvert
in interface org.springframework.core.convert.ConversionService
public Object convert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
convert
in interface org.springframework.core.convert.ConversionService
public <T> T convert(Object source, Class<T> target)
convert
in interface org.springframework.core.convert.ConversionService
public final boolean isFile(FieldType type)
public final boolean isListType(FieldType type)
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Copyright © 2011–2023 aiticon GmbH. All rights reserved.