All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.directwebremoting.extend.OutboundVariable Maven / Gradle / Ivy

Go to download

DWR is easy Ajax for Java. It makes it simple to call Java code directly from Javascript. It gets rid of almost all the boiler plate code between the web browser and your Java code.

The newest version!
/*
 * Copyright 2005 Joe Walker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
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 - 2025 Weber Informatics LLC | Privacy Policy