Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Creating and Initializing Events | Structure Data Fields | Setting Structure Fields | Setting a Struct Field from an Event
Setting a Struct Field from an Event
Because structure fields can contain other fields, the BrokerEvent.setStructFieldFromEvent method allows you to set all of those contained values with just one method call. To use this method, follow these steps.
1. Create an empty event of any event type, using the BrokerEvent constructor. Because the data you will put into this event is not likely to match a real event type definition, create this event without a Broker client so it will not be type checked.
2. Set the fields and values of the event created in step 1 so that they match the fields in the structure you want to set. Use the BrokerEvent.set<type>Field and BrokerEvent.set<type>SeqField methods.
3. Call the BrokerEvent.setStructFieldFromEvent method, passing the event created in the above steps as the source value.
4. Envelope fields on the source event are ignored.