To set a property value that takes a Java object that holds other Java objects, use the atg-rest-class-descriptor control parameter to specify the Java class of the nested objects. For example, if you are setting a property value that takes a List of Sets, indicate the Java class of the Set using the atg-rest-class-descriptor parameter. Then include the values for the nested Sets.

The name of the parameter inside the atg-rest-class-descriptor matches the name of one of the actual values that you supply later in the input parameter.

The input structure for nested multiple value objects builds on the structure for input objects in general. See Object Values in Input.

The following example uses the atg-rest-class-descriptor control parameter to specify that the value of the myListOfSets property is a java.util.ArrayList object. That ArrayList object holds java.util.HashSet objects. After the atg-rest-class-descriptor, the example provides the values that are nested inside the myListOfSets property.

{arg1 : {
  "atg-rest-class-type":"foo.class.WithNestedMultis",
    "atg-rest-class-descriptor": {
      "myListOfSets": {
        "container-class": "java.util.ArrayList",
        "element-class": "java.util.HashSet"
      }
    },
  "myListOfSets": [["red","blue"],["green","yellow"]]
  }
}

Here is the same object property value, encoded in XML.

<arg1>
  <atg-rest-class-type>foo.class.WithNestedMultis</atg-rest-class-type>
  <atg-rest-class-descriptor>
    <myListOfSets>
      <container-class>java.util.ArrayList</container-class>
      <element-class>java.util.HashSet</element-class>
    </myListOfSets>
  </atg-rest-class-descriptor>
  <myListOfSets>
    <element>
      <element>red</element>
      <element>blue</element>
    </element>
    <element>
      <element>green</element>
      <element>yellow</element>
    </element>
  </myListOfSets>
</arg1>
Three or More Nested Levels

Include additional container-class and element-class parameters for each nested level of multiple value objects. The element-class parameter of the parent object holds the additional container-class and element-class parameters.

For example:

"atg-rest-class-descriptor": {
    "myListOfSets": {
      "container-class": "java.util.ArrayList",
      "element-class": {
        "container-class": "java.util.HashSet",
        "element-class": "java.util.HashMap"
      }
    }
  }
Array Types

To specify an array type in the atg-rest-class-descriptor control parameter, use the standard Java notation for arrays.

Array Type

Java Notation

String

[Ljava.lang.String;

byte

[B

int

[I

Two-dimensional array of Strings

[[Ljava.lang.String;

Key Class Types for Map Values

Keys for Map object values must be Strings. No other class types are supported.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices