org.directwebremoting.extend
Class InboundContext

java.lang.Object
  extended by org.directwebremoting.extend.InboundContext

public final class InboundContext
extends java.lang.Object

InboundContext is the context for set of inbound conversions. Since a data set may be recurrsive parts of some data members may refer to others so we need to keep track of who is converted for what.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Nested Class Summary
protected static class InboundContext.Conversion
          A Class to use as a key in a map for conversion purposes
 
Constructor Summary
InboundContext()
           
 
Method Summary
 void addConverted(InboundVariable iv, java.lang.Class type, java.lang.Object bean)
          Add to the (temporary) list of converted objects
 void clearConverted()
          Clear the list of converted objects.
 void createInboundVariable(int callNum, java.lang.String key, java.lang.String type, java.lang.String value)
          Create an inbound variable.
 java.lang.Object getConverted(InboundVariable iv, java.lang.Class type)
          Check to see if the conversion has already been done
 TypeHintContext getCurrentTypeHintContext()
           
 InboundVariable getInboundVariable(java.lang.String name)
          Internal method to allow entries to resolve references
 java.util.Iterator getInboundVariableNames()
          A debug method so people can get a list of all the variable names
 InboundVariable getParameter(int callNum, int index)
          Get a parameter by index
 int getParameterCount()
          How many parameters are there?
 int getParameterCount(int callNum)
          This is a bit of a hack, needed for debug purposes - it counts the parameters (including method and script params) for a given call number
 void popContext()
          Someone wants to tell us about a finished conversion context.
 void pushContext(TypeHintContext context)
          Someone wants to tell us about a new conversion context.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InboundContext

public InboundContext()
Method Detail

pushContext

public void pushContext(TypeHintContext context)
Someone wants to tell us about a new conversion context.

Parameters:
context - The current conversion context

popContext

public void popContext()
Someone wants to tell us about a finished conversion context.


getCurrentTypeHintContext

public TypeHintContext getCurrentTypeHintContext()
Returns:
The method that we are currently converting data for

createInboundVariable

public void createInboundVariable(int callNum,
                                  java.lang.String key,
                                  java.lang.String type,
                                  java.lang.String value)
Create an inbound variable. Usually called by a query parser to setup a list of known variables. This method also checks to see if the new variable is a parameter and if it is it updates the count of parameters

Parameters:
callNum - The call number to work on
key - The name of the variable
type - The javascript type of the variable
value - The value of the variable

getInboundVariable

public InboundVariable getInboundVariable(java.lang.String name)
Internal method to allow entries to resolve references

Parameters:
name - The name of the variable to lookup
Returns:
The found variable

clearConverted

public void clearConverted()
Clear the list of converted objects. If the conversion attempt for a given method failed, we may want to try another so we will need to ditch the list of converted objects because the next method could well have different parameter types.


addConverted

public void addConverted(InboundVariable iv,
                         java.lang.Class type,
                         java.lang.Object bean)
Add to the (temporary) list of converted objects

Parameters:
iv - The converted object
type - The type that we converted the object to
bean - The converted version

getConverted

public java.lang.Object getConverted(InboundVariable iv,
                                     java.lang.Class type)
Check to see if the conversion has already been done

Parameters:
iv - The inbound data to check
type - The type that we want the object converted to
Returns:
The converted data or null if it has not been converted

getParameterCount

public int getParameterCount()
How many parameters are there?

Returns:
The parameter count

getParameterCount

public int getParameterCount(int callNum)
This is a bit of a hack, needed for debug purposes - it counts the parameters (including method and script params) for a given call number

Parameters:
callNum - The Call number to count the parameters of
Returns:
The parameter count for a given Call

getParameter

public InboundVariable getParameter(int callNum,
                                    int index)
Get a parameter by index

Parameters:
callNum - The call number to work on
index - The parameter index
Returns:
The found parameter

getInboundVariableNames

public java.util.Iterator getInboundVariableNames()
A debug method so people can get a list of all the variable names

Returns:
an iterator over the known variable names

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object