Hi John,
can you elaborate that on this example?
Previously, I did this to filter:
result = ExpressionFactory.matchExp( filterPath, filterValue
).filterObjects( result );
Now I tried:
result = result.stream()
.filter( obj -> PropertyUtils.getProperty( obj, filterPath
).equals( filterValue ) )
.collect( Collectors.toList() );
Both times, I get:
java.lang.IllegalArgumentException: Property 'responsibleUser' is not readable
where "result" is like a List<Foo> with Foo being a DataObject that has a
method called "responsibleUser", returning another DataObject subclass.
Maik
> Am 12.04.2017 um 19:11 schrieb John Huss <[email protected]>:
>
> Ok, you can use property utils in conjunction to call a method using
> reflection (with a string name)
> On Wed, Apr 12, 2017 at 6:07 PM Musall, Maik <[email protected]> wrote:
>
>> Hi John,
>>
>> how do you mean that? Those filter paths come from the UI, passed on by
>> the user assembling filter criteria. I wouldn't use string filter paths if
>> the criteria would be constant.
>>
>> Maik
>>
>>> Am 12.04.2017 um 19:03 schrieb John Huss <[email protected]>:
>>>
>>> Just use a java 8 stream and lambda in addition or instead of.
>>> On Wed, Apr 12, 2017 at 4:48 PM Musall, Maik <[email protected]>
>> wrote:
>>>
>>>> Hi,
>>>>
>>>> when filtering a list of objects by expression.filterObjects( list ), is
>>>> there a way for the expression to access regular methods instead of
>> Cayenne
>>>> db properties?
>>>>
>>>> Use Case: I have a class A that has several relationships to class B,
>> and
>>>> it depends on a number of factors which is relevant in this case. So
>> there
>>>> is a method that returns either this or that relation to class B. I
>> would
>>>> like to include the method name in the expression path. (This was
>> possible
>>>> in EOF, and I just found that it doesn't work in Cayenne.)
>>>>
>>>> Thanks
>>>> Maik
>>>>
>>>>
>>
>>