org.directwebremoting.extend
Class InboundVariable

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

public final class InboundVariable
extends java.lang.Object

A simple struct to hold data about a single converted javascript variable. An inbound variable will have either a value or a fileValue but not both. If file is true fileValue will be populated, otherwise value will be populated.

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

Nested Class Summary
static class InboundVariable.OnJsonParseError
           
 
Constructor Summary
InboundVariable(InboundContext context, java.lang.String key, java.lang.String type, FormField fileValue)
          Parsing ctor
InboundVariable(InboundContext context, java.lang.String key, java.lang.String type, java.lang.String value)
          Parsing ctor
 
Method Summary
 void dereference()
          Attempt to de-reference an inbound variable.
 boolean equals(java.lang.Object obj)
           
 FormField getFormField()
           
 JsonValue getJsonValue(InboundVariable.OnJsonParseError onError)
          Convert the set of InboundVariables to JSON
 InboundContext getLookup()
           
 java.lang.String getNamedObjectType()
          If we are using object parameters that have specified types then the ConverterManager will need to get to know what the required type is.
 java.lang.String getValue()
           
 int hashCode()
           
 boolean isNull()
          Was this type null on the way in
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InboundVariable

public InboundVariable(InboundContext context,
                       java.lang.String key,
                       java.lang.String type,
                       java.lang.String value)
Parsing ctor

Parameters:
context - How we lookup references
key - The name of the variable that this was transfered as
type - The type information from javascript
value - The javascript variable converted to a string

InboundVariable

public InboundVariable(InboundContext context,
                       java.lang.String key,
                       java.lang.String type,
                       FormField fileValue)
Parsing ctor

Parameters:
context - How we lookup references
key - The name of the variable that this was transfered as
type - The type information from javascript
fileValue - The javascript variable converted to a FormField
Method Detail

dereference

public void dereference()
                 throws MarshallException
Attempt to de-reference an inbound variable. We try de-referencing as soon as possible (why? there is a good reason for it, it fixes some bug, but I can't remember what right now) However the referenced variable may not exist yet, so the de-referencing may fail, requiring us to have another go later.

Throws:
MarshallException - If cross-references don't add up

getLookup

public InboundContext getLookup()
Returns:
Returns the lookup table.

getNamedObjectType

public java.lang.String getNamedObjectType()
If we are using object parameters that have specified types then the ConverterManager will need to get to know what the required type is.

Returns:
The requested object type, or null if one was not specified

getJsonValue

public JsonValue getJsonValue(InboundVariable.OnJsonParseError onError)
                       throws InvalidJsonException
Convert the set of InboundVariables to JSON

Returns:
This object in JSON
Throws:
InvalidJsonException - If this can't be represented as JSON

isNull

public boolean isNull()
Was this type null on the way in

Returns:
true if the javascript variable was null or undefined.

getValue

public java.lang.String getValue()
Returns:
Returns the value.

getFormField

public FormField getFormField()
Returns:
Returns the file value

toString

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Copyright ¬ 2005