24.11.2. Constraining Maps and Collections
Objects within an object graph can also exist in a
Map
or a Collection (that is, a List
, a Set
, an Array
, etc.). Collections are treated like any other field — for example, if our Widget
contained a list of other Widget
s in its widgetList
field, we would constrain the secret
field of the Widget
s in this list with the following notation:
@WebRemote(exclude = {"widgetList.secret"}) public Widget getWidget();
To constrain a
Map
's key or value, the notation is slightly different. Appending [key]
after the Map
's field name constrains the Map
's key object values, while [value]
constrains the value object values. The following example demonstrates how the values of the widgetMap
field have their secret
field constrained:
@WebRemote(exclude = {"widgetMap[value].secret"}) public Widget getWidget();