|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.directwebremoting.convert.BaseV20Converter
org.directwebremoting.convert.BasicObjectConverter
public abstract class BasicObjectConverter
BasicObjectConverter is a parent to BeanConverter
and
ObjectConverter
an provides support for include and exclude lists,
and instanceTypes.
Field Summary | |
---|---|
protected ConverterManager |
converterManager
To forward marshalling requests |
protected java.util.List |
exclusions
The list of excluded properties |
protected java.util.List |
inclusions
The list of included properties |
protected java.lang.Class |
instanceType
A type that allows us to fulfill an interface or subtype requirement |
protected java.lang.String |
javascript
The javascript class name for the converted objects |
Constructor Summary | |
---|---|
BasicObjectConverter()
|
Method Summary | |
---|---|
java.lang.Object |
convertInbound(java.lang.Class paramType,
InboundVariable iv,
InboundContext inctx)
Attempt to coerce the data from a string to an Object. |
OutboundVariable |
convertOutbound(java.lang.Object data,
OutboundContext outctx)
Return a javascript string that defines the variable named varName to have the contents of the converted object data. |
protected abstract TypeHintContext |
createTypeHintContext(InboundContext inctx,
Property property)
convertInbound(Class, InboundVariable, InboundContext) needs to
create a TypeHintContext for the Property it is
converting so that the type guessing system can do its work. |
protected java.util.Map |
extractInboundTokens(java.lang.Class paramType,
java.lang.String value)
Loop over all the inputs and extract a Map of key:value pairs |
ConverterManager |
getConverterManager()
Accessor for the current ConverterManager |
java.lang.Class |
getInstanceType()
|
java.lang.String |
getJavascript()
Accessor for the javascript class name for the converted objects. |
protected boolean |
isAllowedByIncludeExcludeRules(java.lang.String property)
Check with the access rules to see if we are allowed to convert a property |
void |
setConverterManager(ConverterManager converterManager)
If we are a compound converter that farms out part of the conversion to other converters then you farm the conversion out via a configuration. |
void |
setExclude(java.lang.String excludes)
Set a list of properties excluded from conversion |
void |
setImplementation(java.lang.String name)
|
void |
setInclude(java.lang.String includes)
Set a list of properties included from conversion |
void |
setInstanceType(java.lang.Class instanceType)
|
void |
setJavascript(java.lang.String javascript)
Accessor for the javascript class name for the converted objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.directwebremoting.extend.NamedConverter |
---|
getPropertyMapFromClass, getPropertyMapFromObject |
Field Detail |
---|
protected java.lang.String javascript
protected java.util.List exclusions
protected java.util.List inclusions
protected java.lang.Class instanceType
protected ConverterManager converterManager
Constructor Detail |
---|
public BasicObjectConverter()
Method Detail |
---|
public java.lang.Object convertInbound(java.lang.Class paramType, InboundVariable iv, InboundContext inctx) throws MarshallException
Converter
convertInbound
in interface Converter
paramType
- The type to convert toiv
- The data to convertinctx
- The map of data that we are working on
MarshallException
- If the conversion failed for some reasonprotected abstract TypeHintContext createTypeHintContext(InboundContext inctx, Property property)
convertInbound(Class, InboundVariable, InboundContext)
needs to
create a TypeHintContext
for the Property
it is
converting so that the type guessing system can do its work.
The method of generating a TypeHintContext
is different for
the BeanConverter
and the ObjectConverter
.
inctx
- The parent contextproperty
- The property being converted
public OutboundVariable convertOutbound(java.lang.Object data, OutboundContext outctx) throws MarshallException
Converter
In contrast to convertInbound()
failures in converting
data on the way out should not stop processing, and we should carry on
if we can. Failures are probably down to some misconfiguration so as much
information about the error as can be safely generated to console logs is
good. In other words if you need to loop in outbound conversion then it
might be a good idea to catch issues inside the loop, log, and carry on.
convertOutbound
in interface Converter
data
- The data to convertoutctx
- A collection of objects already converted and the results
MarshallException
- If the conversion failed for some reasonpublic void setExclude(java.lang.String excludes)
excludes
- The space or comma separated list of properties to excludepublic void setInclude(java.lang.String includes)
includes
- The space or comma separated list of properties to excludepublic void setImplementation(java.lang.String name) throws java.lang.ClassNotFoundException
name
- The class name to use as an implementation of the converted bean
java.lang.ClassNotFoundException
- If the given class can not be foundpublic java.lang.Class getInstanceType()
getInstanceType
in interface NamedConverter
public void setInstanceType(java.lang.Class instanceType)
setInstanceType
in interface NamedConverter
instanceType
- The instanceType to set.public void setConverterManager(ConverterManager converterManager)
Converter
setConverterManager
in interface Converter
setConverterManager
in class BaseV20Converter
converterManager
- The confiuration objectpublic ConverterManager getConverterManager()
protected boolean isAllowedByIncludeExcludeRules(java.lang.String property)
property
- The property to test
protected java.util.Map extractInboundTokens(java.lang.Class paramType, java.lang.String value) throws MarshallException
paramType
- The type we are converting tovalue
- The input string
MarshallException
- If the marshalling failspublic java.lang.String getJavascript()
NamedConverter
getJavascript
in interface NamedConverter
public void setJavascript(java.lang.String javascript)
NamedConverter
setJavascript
in interface NamedConverter
javascript
- The Javascript name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |