org.directwebremoting.extend.OutboundVariable Maven / Gradle / Ivy
package org.directwebremoting.extend;
/**
* A simple data container for the strings that comprise information about how a
* Java object has been converted into Javascript.
*
* There are 3 steps to conversion:
*
* - First the {@link ConverterManager} creates a set of OutboundVariables
* from the raw data.
*
- Second we reference count to see what needs to be outlined (i.e. not
* done inline). This typically means that something is declared before it is
* built.
*
- Finally we create the full output script.
*
*
* There are potentially 3 parts to a variable in Javascript. If the variable
* is not something that can recurse then only the assignCode will contain data.
* Otherwise all the parts will be filled out.
*
* - declareCode: To prevent problems with recursion, we declare everything
* first. A declaration will look something like
var s0 = [];
or
* var s1 = {};
.
* - buildCode: Next we fill in the contents of the objects and arrays.
* - assignCode: This is an accessor for the name of the variable so we can
* refer to anything that has been declared.
*
* @author Joe Walker [joe at getahead dot ltd dot uk]
*/
public interface OutboundVariable
{
/**
* Get a reference to this OutboundVariable.
* During step 1 of the conversion process where we turn the raw objects
* into OutboundVariables we may wish to refer to something that has already
* been converted.
* If this
already is a reference then this method returns
* this
, or if not it creates one that does.
* @return An OutboundVariable that refers to this one.
*/
OutboundVariable getReferenceVariable();
/**
* A script to declare the variable so it can be referred to. This script
* is guaranteed not to refer to anything that can recurse
* @return Returns the declareCode
*/
String getDeclareCode();
/**
* A script that completes the definition of this variable, and may contain
* reference to other declared variables.
* @return Returns the buildCode.
*/
String getBuildCode();
/**
* A short script that can be used to refer to this variable
* @return Returns the assignCode.
*/
String getAssignCode();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy