[cas-dev] Principal.toString

Marvin S. Addison serac at exchange.vt.edu
Thu May 31 13:19:56 EDT 2007


> I'd be reluctant for the Principal *interface* to constrain 
> implementations as to what they ought to do the details of what their 
> toString() output ought to look like, but I'm in wholehearted
> agreement that the implementations should implement the method.

I agree that putting it in the interface is both inelegant and offtopic
to the main purpose of Principal, but it would be great if there were a
contract enforcing implementers to provide an informative string
representation of a Principal (and possibly other classes).  Without
that contract, implementers can avoid (and have avoided so far as I can
tell) overriding Object.toString() in concrete subclasses.

Maybe you're right that development policy is an adequate solution,
where any class that might be of value to have a string representation,
like a concrete implementation of Principal, will override
Object.toString().  Here's my +1 for such a policy.

M


More information about the cas-dev mailing list