On 2018-02-25 10:24, Ronald Appelfelder wrote:
...
With variant 1 I get a compiler error:
cannot find symbol
symbol: method getTotalSize()
location: variable result of type javax.jcr.query.QueryResult
With variant 2 I get a runtime error:
java.lang.ClassCastException: \
org.apache.jackrabbit.core.query.lucene.SingleColumnQueryResult \
cannot be cast to org.apache.jackrabbit.api.query.JackrabbitQueryResult
I have also tried other casting variants, but all my attempts result in a
ClassCastException.
Is there anyone out there who can enlighten me?
...
Well, SingleColumnQueryResult doesn't implement JackrabbitQueryResult -
not sure why or whether it should.
In general, you should not rely on extensions, so do something like
if(x instanceof JackrabbitQueryResult) {
y = ((JackrabbitQueryResult)x).getTotalSize();
} else {
// do something else
}
Best regards, Julian