|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.directwebremoting.dwrp.DefaultConverterManager
public class DefaultConverterManager
A class to manage the converter types and the instansiated class name matches.
Constructor Summary | |
---|---|
DefaultConverterManager()
|
Method Summary | |
---|---|
void |
addConverter(java.lang.String match,
Converter converter)
Add a new converter |
void |
addConverter(java.lang.String match,
java.lang.String type,
java.util.Map params)
Add a new converter |
void |
addConverterType(java.lang.String id,
java.lang.String className)
Add a new converter type |
java.lang.Object |
convertInbound(java.lang.Class paramType,
InboundVariable iv,
InboundContext inctx,
TypeHintContext incc)
Convert an object from being a string into an object of some type. |
OutboundVariable |
convertOutbound(java.lang.Object object,
OutboundContext outctx)
Convert an object into a Javavscript representation of the same. |
Converter |
getConverterByMatchString(java.lang.String match)
In order to be able to create stub remote objects we need to know what they are so you can lookup match strings and retrieve the converter. |
java.util.Collection |
getConverterMatchStrings()
In order to be able to create stub remote objects we need to know what they are so you can get a collection of all match strings. |
java.lang.Class |
getExtraTypeInfo(TypeHintContext thc)
The extra type information that we have learnt about a method parameter. |
protected Converter |
getNamedConverter(java.lang.Class paramType,
java.lang.String type)
When we are using typed Javascript names we sometimes want to get a specially named converter |
boolean |
isConvertable(java.lang.Class paramType)
Check if we can coerce the given type |
void |
setConverters(java.util.Map converters)
Sets the converters for this converter manager. |
void |
setExtraTypeInfo(TypeHintContext thc,
java.lang.Class type)
We don't know enough from a method signature like setUsers(Set s) to be able to cast the inbound data to a set of Users. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultConverterManager()
Method Detail |
---|
public void addConverterType(java.lang.String id, java.lang.String className)
ConverterManager
addConverterType
in interface ConverterManager
id
- The name of the converter typeclassName
- The class to do the conversionpublic void addConverter(java.lang.String match, java.lang.String type, java.util.Map params) throws java.lang.IllegalArgumentException, java.lang.InstantiationException, java.lang.IllegalAccessException
ConverterManager
addConverter
in interface ConverterManager
match
- The class name(s) to matchtype
- The name of the converter typeparams
- The extra parameters to allow the creator to configure itself
java.lang.IllegalArgumentException
- If we have a duplicate name
java.lang.InstantiationException
- If reflection based creation fails
java.lang.IllegalAccessException
- If reflection based creation failspublic void addConverter(java.lang.String match, Converter converter) throws java.lang.IllegalArgumentException
ConverterManager
addConverter
in interface ConverterManager
match
- The class name(s) to matchconverter
- The converter to add
java.lang.IllegalArgumentException
- If we have a duplicate namepublic java.util.Collection getConverterMatchStrings()
ConverterManager
getConverterMatchStrings
in interface ConverterManager
ConverterManager.getConverterByMatchString(String)
public Converter getConverterByMatchString(java.lang.String match)
ConverterManager
getConverterByMatchString
in interface ConverterManager
match
- The match string to lookup
ConverterManager.getConverterMatchStrings()
public boolean isConvertable(java.lang.Class paramType)
ConverterManager
isConvertable
in interface ConverterManager
paramType
- The type to check
paramType
is coercablepublic java.lang.Object convertInbound(java.lang.Class paramType, InboundVariable iv, InboundContext inctx, TypeHintContext incc) throws MarshallException
ConverterManager
convertInbound
in interface ConverterManager
paramType
- The type that you want the object to beiv
- The string version of the objectinctx
- The map of data that we are working onincc
- The context of this type conversion
MarshallException
- If the conversion failed for some reasonpublic OutboundVariable convertOutbound(java.lang.Object object, OutboundContext outctx) throws MarshallException
ConverterManager
convertOutbound
in interface ConverterManager
object
- The object to convertoutctx
- The list of converted objects so far
MarshallException
- If the conversion failed for some reasonpublic void setExtraTypeInfo(TypeHintContext thc, java.lang.Class type)
ConverterManager
setExtraTypeInfo
in interface ConverterManager
thc
- The context to find any extra type information fromtype
- The type of the specified parameter.public java.lang.Class getExtraTypeInfo(TypeHintContext thc)
ConverterManager
getExtraTypeInfo
in interface ConverterManager
thc
- The context to find any extra type information from
public void setConverters(java.util.Map converters)
ConverterManager
setConverters
in interface ConverterManager
converters
- the map of match pattern and their converter instancesprotected Converter getNamedConverter(java.lang.Class paramType, java.lang.String type) throws MarshallException
paramType
- The class that we are converting totype
- The type name as passed in from the client
MarshallException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |