Property Iteration

The getPropertyNames( ) method in the Message interface can be used to obtain an Enumeration of all the property names contained in the message. These names can then be used to obtain the property values using the property accessor methods. The following code shows how you might use this Enumeration to print all the property values:

public void onMessage(Message message) {
    Enumeration propertyNames = message.getPropertyNames( );
    while(propertyNames.hasMoreElements( )){
       String name = (String)propertyNames.nextElement( );
       Object value = getObjectProperty(name);
       System.out.println("
name+" = "+value);
    }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset