Re: Extended Enumerations

From: Michael Gentry (blacknex..mail.com)
Date: Mon Feb 25 2008 - 11:32:19 EST

  • Next message: Kevin Menard: "RE: Extended Enumerations"

    By typing, I assume you mean the return type? That's why I originally
    had two different interfaces:

    public interface IntegerEnumeration
    {
       public Integer databaseValue();
    }

    public interface StringEnumeration
    {
       public String databaseValue();
    }

    I then decided to collapse it down into one thinking that might be
    easier on the user. Cayenne internally does care which one it is (I
    use instanceof Integer/String on the return value to determine it).
    It actually made the Cayenne code a tad easier to deal with only one
    interface, but the real answer is if it is better for the end-user to
    only have to deal with one interface (I think).

    Thanks,

    /dev/mrg

    On Mon, Feb 25, 2008 at 11:18 AM, Kevin Menard <kmenar..ervprise.com> wrote:
    > All in all, this looks like a good step in the right direction. I might
    > recommend typing ExtendedEnumeration. You may even be able to constrain
    > the domain to both String & Integer via wildcards, but that'd likely be
    > an evil beast to inflict on someone. That would allow you to tighten
    > the contract on the return type though (or at least force the developer
    > to specify it).
    >
    > On the other hand, if I always work with String or Integer, it could get
    > annoying to type it every time, especially if Cayenne ultimately doesn't
    > care.
    >
    > --
    > Kevin Menard
    > Servprise International, Inc.
    > Remote reboot & power control for your network
    > www.servprise.com +1 508.892.3823 x308



    This archive was generated by hypermail 2.0.0 : Mon Feb 25 2008 - 11:32:59 EST