Java Reference
In-Depth Information
B
This interface uses all three techniques to aggregate information, but we are most
interested in the parameter list. In this list, we have a
boardName
and
discus-
sionID
. We also have a collection of attributes that we bind together with a
post
object that is nothing more than a collection of fields. In the original interface, we
needed to make several method calls, whereas this interface uses just one. We can
use this technique to collect several sets into a composite interface with a single
method call. The command interface uses this approach by having many local set
calls, a distributed
execute
call, followed again by local
get
s.
C
This interface illustrates the use of a collection to aggregate many round-trips into
one. We'd normally have to make a round-trip for every object in the vector.
Instead, with this interface, we retrieve a single buffer that has many objects. We
also collect many different
get
calls into a single interface, because we'd normally
have to use the remote accessors for each of the attributes. Instead, we call once.
D
This interface demonstrates the collection of several round-trips with a single com-
posite object. In this example, we have three composite objects.
This is the object for the board:
package com.bitterjava.bbs;
public class Board implements java.io.Serializable {
private java.lang.String name;
private java.util.Collection discussions;
public java.lang.String getName() {
return name;
}
public java.util.Collection getDiscussions() {
return discussions;
}
public void setName(String name) {
this.name = name;
}
public void setDiscussions(java.util.Vector discussions) {
this.discussions = discussions;
}
}
We aren't interested in encapsulating any behaviors here, since our behaviors
are captured in our model. We simply need a helper class so that we can orga-
nize all of the different parameters in our interface.