Voice enabling your data structures: the Playable interface

Your application could have access to data structures that you want to present to the caller over the telephone. For example, the application may lookup a caller's order information in a database and play the information back to the caller. The Playable interface allows you to create a class which takes this information and turns it into something which can be played by any method which can play a MediaType object. The Playable interface defines one method, toMedia(), which takes no parameters and returns an array of MediaTypes. When the Playable object is passed into a method that plays MediaTypes (for example, Call.play()), its toMedia() method is invoked to return the array of MediaType objects to play to the caller.

For an example of a class that implements the Playable interface, see Example 8: Order information (menu item 3 continued).