public class RequestSupportImpl extends Object implements RequestSupport
RequestSupport
implementationModifier and Type | Field and Description |
---|---|
protected 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 MessageSource |
messageSource |
Constructor and Description |
---|
RequestSupportImpl() |
RequestSupportImpl(ConversionService conversionService,
Environment environment,
MessageSource messageSource) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEnvironment, getFieldConverter, getMessageSource
protected static final String CURRENT
protected ConversionService conversionService
protected MessageSource messageSource
protected Environment environment
protected ExpressionEvaluator expressionEvaluator
protected FieldConversionFactory fieldConverter
public RequestSupportImpl()
public RequestSupportImpl(ConversionService conversionService, Environment environment, 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 ConversionService
public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
canConvert
in interface ConversionService
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
convert
in interface ConversionService
public <T> T convert(Object source, Class<T> target)
convert
in interface ConversionService
public ConversionService getConversionService()
public void setConversionService(ConversionService conversionService)
public MessageSource getMessageSource()
public void setMessageSource(MessageSource messageSource)
public Environment getEnvironment()
public void setEnvironment(Environment environment)
public ExpressionEvaluator getExpressionEvaluator()
public void setExpressionEvaluator(ExpressionEvaluator expressionEvaluator)
public final boolean isFile(FieldType type)
public final boolean isListType(FieldType type)
public FieldConverter getFieldConverter()
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
Copyright © 2011–2017 aiticon GmbH. All rights reserved.