Indexed Properties

An indexed property consists of multiple values. It can be identified by following
design patterns. where N is,the’ name of the property and ‘I’ is its type:
public T getN(int illde,.)
public void setN(int index, T value);
public T[‘] getN( )
public void sptN(T value[ f)

Design Patterns for Events

Beans use the delegation event model that was discussed earlier in this book. Beans
can generate events and send them to other objects. These can be identified by the
following design patterns, where T is the type of the event:
public void addTListener(TListener eventListener);
public void addTListener(TListener eventListener) throws TooManyListeners;
public void remove TListener(TListener eoentl.isteneri;

These methods are’used by event listeners to reg;,ter an interest in events of a  specifictype. The first pattern indicates that a Bean can multicast an eveht to multiple listeners .  The second pattern indicates that a Bean ‘can ul’t.cast an event to only one listener . The,third pattern is used by a listener when it no longer wishes to receive a specific type of, event notification from a Bean. The following listing  outlines a class that notifies other objects when a temperature value moves outside specific range. The two methods indicated here allow other .  objects that  implement-the Temperature Listener interface. to receive notifications.when
this occurs


Design patterns are not used for naming non property methods, ?llC introspection
mechanism finds all of the public methods of a Bean. Protected and private methods
are not presented.

reCAPTCHA is required.

Share This