ref_send API 2.17
defensive programming in Java

Package org.ref_send.scope

A pass-by-copy interface.

See:
          Description

Class Summary
Layout<T> Structural type of a Scope.
OK An empty object.
Scope<T> A { name : value } record.
 

Exception Summary
Unavailable Signals use of an unavailable name.
 

Package org.ref_send.scope Description

A pass-by-copy interface.

The API in this package enables creation of pass-by-copy data structures without the requirement to define corresponding Java classes imposed by the pass-by-construction API.

Instances of Scope are sent pass-by-copy when used as arguments in remote invocations. The networking code in the Waterken Server automatically produces a corresponding JSON object with the names and values specified in a Scope. For example, this code:

 Layout.define("name",        "year", "premium").
          make("Tyler Close", 2008,   true);
 

produces a Scope that will be encoded in JSON as:

 
 {
   "name" : "Tyler Close",
   "year" : 2008,
   "premium" : true
 }
 

And the following code:

 Layout.define("name",        "year", "premium", "mailto", "preferences").
          make("Tyler Close", 2008,   true,      Layout.define(
                   "street",              "city",      "state", "zip").
              make("1501 Page Mill Road", "Palo Alto", "CA",    "94304"),
              ConstArray.array("2-day-shipping", "monthly"));
 

produces a Scope that will be encoded in JSON as:

 
 {
   "name" : "Tyler Close",
   "year" : 2008,
   "premium" : true,
   "mailto" : {
     "street" : "1501 Page Mill Road",
     "city" : "Palo Alto",
     "state" : "CA",
     "zip" : "94304"
   },
   "preferences" : [ "2-day-shipping", "monthly" ]
 }
 

See Also:
org.ref_send

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.