What are Entry Beans and what are they used for?

Tim Rohaly

Service attributes, which are implementations of Entry, have peculiar requirements (see FAQ http://www.jguru.com/jguru/faq/view.jsp?EID=61187), such as all instance variables must be public and must be references to object types.

One of the principles of object-oriented programming is that the implementation of an object, its internal state, should be hidden - this is typically accomplished by making instance variables inaccessible and providing accessor and mutator methods ("getters" and "setters") through which users of that object may modify its state. The JavaBeans specification formalizes this practice and defines the concept of a "property", along with ways that a JavaBeans container can instrospect the properties of an object. The restrictions imposed on classes implementing Entry make it impossible for attributes to be JavaBeans, and are contrary to commonly-accepted OO programming practices.

Entry beans are simple wrapper classes used to provide a JavaBeans-compliant interface for attributes. An entry bean contains an instance of an attribute and defines accessor and mutator methods so the attribute's fields can be recognized as JavaBeans properties. An entry bean must also implement EntryBean and must be serializable.

It is required that entry beans have the same name as their contained Entry class, with the added suffix Bean. For example, the Address entry, defined in the net.jini.lookup.entry package, has a corresponding AddressBean entry bean in the same package.

The concept of entry beans is defined so that attributes may be used as components, for example using an integrated development environment, and may be manipulated programmatically.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact