Re: [Meinds-developers] Aspects: pro's and con's
Brought to you by:
emcs,
rickardoberg
|
From: Rickard <ri...@xp...> - 2001-11-30 12:36:18
|
Dmitri Colebatch wrote:
> duh! maybe like the one in ObjectFactory (o: ok... no more from
> me...
;-)
> I'm just wondering if the problem is that we're trying to do OO
> coding style and have the common Individual interface, when really we
> should just be using differnet interfaces as we require... then if we had
> a method in ObjectFactory that "casted" one aspect to another... so you
> could do something like:
>
> User user = UserBuilder.createObject("urn:user:dim");
> // use user
> user.getName();
>
> ACL acl = ObjectFactory.cast(user, ACL.class);
> // use ACL
This would work just fine, yes. You can either use the aspects of an
object that it already has (by casting/invoking it), or you can attach
any aspect to it as necessary. I.e. either the above (which is an
example of dynamically attaching aspects and then using them), or you
could do:
User user = IndividualBuilder.getIndividual("urn:user:dim");
user.getName();
ACL acl = (ACL)user;
acl.check(..);
/Rickard
--
Rickard Öberg
|