You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lon Varscsak <lo...@gmail.com> on 2019/11/14 22:50:20 UTC

New "Property" classes requiring Persistent

Hey all,

I use Property-type classes for all sorts of things, usually for Cayenne
related activities...but sometimes they're really useful on POJOs too.  The
new Property related classes (like EntityProperty) require the class to be
a subclass of Persistent.  I can't see where this is actually
relevant...but I might be missing something.  Any reason we couldn't remove
this restriction?

Thanks,

Lon

P.S. -- Still wishing these also implemented Serializable :P

Re: New "Property" classes requiring Persistent

Posted by Nikita Timofeev <nt...@objectstyle.com>.
Finally got some time to read and comment on this.
I'm in favor of keeping Persistent limitations as I prefer to keep
more constraints.
It sends a clear signal to users and adds some protection of faulty usage.
And after all, It's always easier to remove limitations than add.

In case of usage Property API with POJOs (or in any other advanced cases),
it's better to create own property and add relevant functionality to it.

Finally, I agree with Lon, that we should use the Property interface
wherever possible.
IIRC BaseProperty appeared earlier than the Property interface, so
it's stuck where it shouldn't.

On Sat, Nov 23, 2019 at 4:38 AM Lon Varscsak <lo...@gmail.com> wrote:
>
> Also consider that where you take BaseProperty, but don't really require
> anything beyond the interface of Property, to use Property instead.  In
> theory this would let me create my own property classes but still be
> cayenne compliant (but also be open to doing other things I want to do for
> my web framework).
>
> On Tue, Nov 19, 2019 at 11:25 PM Andrus Adamchik <an...@objectstyle.org>
> wrote:
>
> > My vote would be to also remove a limitation on the object to extend
> > Persistent in the Property API. From a quick glance, none of the
> > functionality requires it, so this is purely a design decision. Expression
> > class does not imply Persistent object anywhere, so I guess Property should
> > not either.
> >
> > @Nikita, what do you think?
> >
> > Andrus
> >
> >
> > > On Nov 15, 2019, at 1:50 AM, Lon Varscsak <lo...@gmail.com>
> > wrote:
> > >
> > > Hey all,
> > >
> > > I use Property-type classes for all sorts of things, usually for Cayenne
> > > related activities...but sometimes they're really useful on POJOs too.
> > The
> > > new Property related classes (like EntityProperty) require the class to
> > be
> > > a subclass of Persistent.  I can't see where this is actually
> > > relevant...but I might be missing something.  Any reason we couldn't
> > remove
> > > this restriction?
> > >
> > > Thanks,
> > >
> > > Lon
> > >
> > > P.S. -- Still wishing these also implemented Serializable :P
> >
> >



-- 
Best regards,
Nikita Timofeev

Re: New "Property" classes requiring Persistent

Posted by Lon Varscsak <lo...@gmail.com>.
Also consider that where you take BaseProperty, but don't really require
anything beyond the interface of Property, to use Property instead.  In
theory this would let me create my own property classes but still be
cayenne compliant (but also be open to doing other things I want to do for
my web framework).

On Tue, Nov 19, 2019 at 11:25 PM Andrus Adamchik <an...@objectstyle.org>
wrote:

> My vote would be to also remove a limitation on the object to extend
> Persistent in the Property API. From a quick glance, none of the
> functionality requires it, so this is purely a design decision. Expression
> class does not imply Persistent object anywhere, so I guess Property should
> not either.
>
> @Nikita, what do you think?
>
> Andrus
>
>
> > On Nov 15, 2019, at 1:50 AM, Lon Varscsak <lo...@gmail.com>
> wrote:
> >
> > Hey all,
> >
> > I use Property-type classes for all sorts of things, usually for Cayenne
> > related activities...but sometimes they're really useful on POJOs too.
> The
> > new Property related classes (like EntityProperty) require the class to
> be
> > a subclass of Persistent.  I can't see where this is actually
> > relevant...but I might be missing something.  Any reason we couldn't
> remove
> > this restriction?
> >
> > Thanks,
> >
> > Lon
> >
> > P.S. -- Still wishing these also implemented Serializable :P
>
>

Re: New "Property" classes requiring Persistent

Posted by Andrus Adamchik <an...@objectstyle.org>.
My vote would be to also remove a limitation on the object to extend Persistent in the Property API. From a quick glance, none of the functionality requires it, so this is purely a design decision. Expression class does not imply Persistent object anywhere, so I guess Property should not either. 

@Nikita, what do you think?

Andrus


> On Nov 15, 2019, at 1:50 AM, Lon Varscsak <lo...@gmail.com> wrote:
> 
> Hey all,
> 
> I use Property-type classes for all sorts of things, usually for Cayenne
> related activities...but sometimes they're really useful on POJOs too.  The
> new Property related classes (like EntityProperty) require the class to be
> a subclass of Persistent.  I can't see where this is actually
> relevant...but I might be missing something.  Any reason we couldn't remove
> this restriction?
> 
> Thanks,
> 
> Lon
> 
> P.S. -- Still wishing these also implemented Serializable :P


Re: New "Property" classes requiring Persistent

Posted by John Huss <jo...@gmail.com>.
For a very quick reply, I would recommend using the Java 8 streams API
.filter, etc instead of Property for doing things with POJOs. This should
perform better and be more debuggable, and be only slightly more verbose.

On Thu, Nov 14, 2019 at 4:50 PM Lon Varscsak <lo...@gmail.com> wrote:

> Hey all,
>
> I use Property-type classes for all sorts of things, usually for Cayenne
> related activities...but sometimes they're really useful on POJOs too.  The
> new Property related classes (like EntityProperty) require the class to be
> a subclass of Persistent.  I can't see where this is actually
> relevant...but I might be missing something.  Any reason we couldn't remove
> this restriction?
>
> Thanks,
>
> Lon
>
> P.S. -- Still wishing these also implemented Serializable :P
>