[Yanel-dev] Introducing User.getFirstname() and User.getLastname()
Michael Wechner
michael.wechner at wyona.com
Thu Mar 22 14:13:22 CET 2012
Am 22.03.12 13:48, schrieb basZero:
> Hi Michael,
> I'd go for a backwards compatible approach:
ok
> maybe there is a possibility to extend the current YarepUser class
> with a new one (YarepUserV2) like you do it when you extend it for
> realm specific user properties.
Well, the disadvantage would be that this would work for only for
projects using the YarepUser implementation and for example we ourselves
have quite a few projects which don't do that.
In order to stay backwards compatible independent of the implementation
I would introduce a new interface e.g. called
public interface ProfileV1 {
public String getFirstname();
public String getLastname();
}
and then implement this by YarepUser implementation:
public class YarepUser extends YarepItem implements User, ProfileV1 {
....
}
which then allows to check on the interface
if (org.wyona.commons.clazz.ClazzUtil.implementsInterface(user,
"ProfileV1")) {
String firstname = ((ProfileV1)user).getFirstname()
} else {
log.warn("User implementation does not provide service/interface
getFirstname()");
}
Thanks
Michael
> Cheers
> Balz
>
> On Thu, Mar 22, 2012 at 1:45 PM, Michael Wechner
> <michael.wechner at wyona.com <mailto:michael.wechner at wyona.com>> wrote:
>
> Hi
>
> Currently the interface
>
> org/wyona/security/core/api/User
>
> only supports
>
> org/wyona/security/core/api/User#getName() (inherited from
> org/wyona/security/core/api/Item).
>
> which is also supported by
>
> src/core/java/org/wyona/security/core/api/Group
>
> because it also inherits the Item class.
>
> From a User class point of view this is not really good, because
> one would expect
>
> getFirstname()
> getLastname()
>
> Also it would be nice to set "custom" properties (String and
> Binary/Streams)
>
> setProperty(String name)
> getProperty(String name)
>
> etc.
>
> Hence I would like to enhance the API, but this means that all
> implementations based on this API will break.
> As an alternative one could introduce a new version of this API,
> which would make it completely backwards compatible,
> but more complicated.
>
> WDYT?
>
> Thanks
>
> Michael
> --
> Yanel-development mailing list Yanel-development at wyona.com
> <mailto:Yanel-development at wyona.com>
> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wyona.org/pipermail/yanel-development/attachments/20120322/df4e5b2b/attachment.html>
More information about the Yanel-development
mailing list