When the PropertyCollector returns array data representing an array of Event objects, the array has the type xsd:anyType. To use the data in your application, you must first cast it to a specialized type for Event arrays.
This example code uses the JAX-WS-generated Java bindings for the VMware vSphere Web Services SDK WSDL.
Procedure
- Use the DynamicProperty.getVal() method to retrieve the anyType property value.
- Cast the anyType value to a value of type ArrayOfEvent.
- Use the corresponding get method to assign the result of the cast operation to a list variable.
Example
/* * Handling arrays of Event objects. * Cast the return value to ArrayOfEvent and use getEvent(). */ List[] eventList = ((ArrayOfEvent) dynamicProp.getVal()).getEvent();