org.mmbase.util
Class BridgeCaster

java.lang.Object
  extended by org.mmbase.util.BridgeCaster
All Implemented Interfaces:
Caster

public class BridgeCaster
extends Object
implements Caster

Plugged into Casting to supply some extra casting based on the availability of an MMBase Bridge.

Since:
MMBase-2.0

Nested Class Summary
static class BridgeCaster.NodeListWrapper
           
 
Nested classes/interfaces inherited from interface org.mmbase.util.Caster
Caster.NotRecognized
 
Constructor Summary
BridgeCaster()
           
 
Method Summary
 boolean isStringRepresentable(Class<?> type)
           
 boolean toBoolean(Object i)
           
static DataType<?> toDataType(Object o)
           
 double toDouble(Object i)
           
 float toFloat(Object i)
           
 int toInt(Object i)
           
 long toLong(Object i)
           
 Map toMap(Object o)
           
static Node toNode(Object i, Cloud cloud)
          Convert an object to an Node.
 String toString()
           
 String toString(Object s)
           
<C> C
toType(Class<C> type, Object cloud, Object value)
           
 Object unWrap(Object o)
           
 Object wrap(Object o, CharTransformer escaper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BridgeCaster

public BridgeCaster()
Method Detail

toType

public <C> C toType(Class<C> type,
                    Object cloud,
                    Object value)
         throws Caster.NotRecognized
Specified by:
toType in interface Caster
Throws:
Caster.NotRecognized

wrap

public Object wrap(Object o,
                   CharTransformer escaper)
            throws Caster.NotRecognized
Specified by:
wrap in interface Caster
Throws:
Caster.NotRecognized

unWrap

public Object unWrap(Object o)
              throws Caster.NotRecognized
Specified by:
unWrap in interface Caster
Throws:
Caster.NotRecognized

toMap

public Map toMap(Object o)
          throws Caster.NotRecognized
Specified by:
toMap in interface Caster
Throws:
Caster.NotRecognized

toInt

public int toInt(Object i)
          throws Caster.NotRecognized
Specified by:
toInt in interface Caster
Throws:
Caster.NotRecognized

toBoolean

public boolean toBoolean(Object i)
                  throws Caster.NotRecognized
Specified by:
toBoolean in interface Caster
Throws:
Caster.NotRecognized

isStringRepresentable

public boolean isStringRepresentable(Class<?> type)
Specified by:
isStringRepresentable in interface Caster

toLong

public long toLong(Object i)
            throws Caster.NotRecognized
Specified by:
toLong in interface Caster
Throws:
Caster.NotRecognized

toFloat

public float toFloat(Object i)
              throws Caster.NotRecognized
Specified by:
toFloat in interface Caster
Throws:
Caster.NotRecognized

toDouble

public double toDouble(Object i)
                throws Caster.NotRecognized
Specified by:
toDouble in interface Caster
Throws:
Caster.NotRecognized

toString

public String toString(Object s)
                throws Caster.NotRecognized
Specified by:
toString in interface Caster
Throws:
Caster.NotRecognized

toNode

public static Node toNode(Object i,
                          Cloud cloud)
Convert an object to an Node. If the value is Numeric, the method tries to obtain the mmbase object with that number. A Map returns a virtual Node representing the map, (a MapNode). All remaining situations return the node with the alias i.toString(), which can be null if no node which such an alias.

Parameters:
i - the object to convert
cloud - the Cloud to use for loading a node
Returns:
the value as a Node
Since:
MMBase-1.7

toDataType

public static DataType<?> toDataType(Object o)
Since:
MMBase-1.9.1

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null