May 2009
Intermediate to advanced
330 pages
10h 34m
English
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("\nname+" = "+value);
}
}Read now
Unlock full access