On 2 April 2014 19:42, Hardy Ferentschik <hardy(a)hibernate.org> wrote:
On 2 Jan 2014, at 18:30, Emmanuel Bernard <emmanuel(a)hibernate.org> wrote:
> Hardy,
>
> Today the actual bridge fails during set() if the object passed is not of a specified
subset of types (Blob, etc).
Right, that happens in TikaBridge#getInputStreamForData
> This means the failure happens at the first indexing usage.
Correct
> Is that ok / preferable if I do these type checking at the bridge creation time - in
the BridgeProvider.
Not sure. AS you say, the problem is if you define the type as Object. Probably quite
uncommon.
I'd enforce it. If a getter guarantees to provide a refined type, it
could as well make it explicit on the signature.
There is no (sane) reason to refuse fixing the signature, if you know
for sure what you're returning will be compatible. Worst case the
implementor will need to explicitly downcast, but when the CCE strikes
he'll easily see his mistake.
> It seems like a small flexibility loss and we would gain clearer
error messages: if something is annotated @TikaBridge and we don’t support the type we
will fail fast.
Fail fast sounds good.
+1
—Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev