Thanks Nikita! I suspected this was the case. More of an issue for the dev-list but I've sometimes wondered if it might be sensible to consider introducing subclasses of Property to handle properties of different types? For examle, a ToManyRelationshipProperty could include a contains( destinationTypeObject ) method which would create an Expression to check for a related object, while a StringProperty would use the current contains( String ) implementation. A somewhat big and potentially breaking change, though :-/.
Cheers, - hugi > On 26 Sep 2017, at 11:08, Nikita Timofeev <[email protected]> wrote: > > Hi > > No there isn't any shortcut for now, use > ExpressionFactory.matchExpression( String, Object ), or you can try > generic erasure tricks, but that's ugly. > I've created issue for that case sometime ago [1] but not sure how to > deal with it. > > [1] https://issues.apache.org/jira/browse/CAY-2332 > > On Tue, Sep 26, 2017 at 1:04 PM, Hugi Thordarson <[email protected]> wrote: >> Hi all, >> is there a shortcut method from Property to check for if a to-many >> relationship contains an object? Or should I just use >> ExpressionFactory.matchExpression( String, Object ) for now? >> >> I'm upgrading my templates to use field based data objects, but the new >> templates use Property<List<E>> for to-many relationships whereas my old >> templates just used Property<E>. The new signature makes sense, but it also >> means that I can no longer use Property.eq( E ) for this. >> >> Cheers, >> - hugi > > > > -- > Best regards, > Nikita Timofeev
