Cheng Fang wrote:
>
>
> Is it allowed to declare those public methods in java.lang.Object
> (hashCode, equals, toString, wait, notify, finalize) as business
> methods? Most of them shouldn't be used as business methods, so as
> not to interfere with container management. But it seems reasonable
> to overide toString() as business method, just to return better
> descriptions.
The only ones explicitly mentioned by the spec are equals and hashCode
(4.7.3) , whose implementations need to be provided by the container for
business object references. However, I'd say exposing any of these
implementation object contracts through a component interface is a bad
idea. I'd agree that toString is probably the least harmful but it's
still very confusing to mix a J2SE implementation object contract with a
business component operation. They are two separate levels of
abstraction. Furthermore, vendors are given lots of leeway in terms
how they implement ejb references. It can pose problems to require
that java.lang.Object methods be exposable as business methods. You
can always just define a speciifc business method that returns a string
representation of your component and implement it internally as a call
toString(). Perhaps a future version of the spec can clarify that all
methods of java.lang.Object are ineligible for exposing as business
method implementations.
>
>