Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Section C.6. Property Iteration

C.6. 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("\nname+" = "+value);
    }
}


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint