org.hibernate.search.bridge.spi
Interface ConversionContext

All Known Implementing Classes:
ContextualExceptionBridgeHelper

public interface ConversionContext

Setting the context before invoking a conversion bridge will provide more helpful exceptions in case of errors. This is especially important as bridge implementations often need to make assumptions about the data formats and are user provided.

Author:
Sanne Grinovero (C) 2012 Red Hat Inc., Hardy Ferentschik

Method Summary
 FieldBridge oneWayConversionContext(FieldBridge delegate)
          Decorates a FieldBridge.
 ConversionContext popProperty()
          Pops the last pushed property from the stack.
 ConversionContext pushIdentifierProperty()
          In case the next conversion fails, the error message will point to the document id of the currently indexed type.
 ConversionContext pushProperty(String property)
          The context has an internal stack for graph navigation.
 ConversionContext setClass(Class<?> beanClass)
          In case the next conversion fails, the error message will point to this type.
 StringBridge stringConversionContext(StringBridge delegate)
          Decorates a StringBridge.
 TwoWayFieldBridge twoWayConversionContext(TwoWayFieldBridge delegate)
          Decorates a TwoWayFieldBridge.
 

Method Detail

oneWayConversionContext

FieldBridge oneWayConversionContext(FieldBridge delegate)
Decorates a FieldBridge.

Parameters:
delegate - set the bridge that shall be used by the decoration.
Returns:
a decorated FieldBridge which should be used instead of the original delegate.

twoWayConversionContext

TwoWayFieldBridge twoWayConversionContext(TwoWayFieldBridge delegate)
Decorates a TwoWayFieldBridge.

Parameters:
delegate - set the bridge that shall be used by the decoration.
Returns:
a decorated TwoWayFieldBridge which should be used instead of the original delegate.

stringConversionContext

StringBridge stringConversionContext(StringBridge delegate)
Decorates a StringBridge.

Parameters:
delegate - set the bridge that shall be used by the decoration.
Returns:
a decorated StringBridge which should be used instead of the original delegate.

setClass

ConversionContext setClass(Class<?> beanClass)
In case the next conversion fails, the error message will point to this type.

Parameters:
beanClass - the class type which is going to be converted
Returns:
this for method chaining.

pushIdentifierProperty

ConversionContext pushIdentifierProperty()
In case the next conversion fails, the error message will point to the document id of the currently indexed type.

Returns:
this for method chaining.

pushProperty

ConversionContext pushProperty(String property)
The context has an internal stack for graph navigation. Pushing a property on the stack will make sure we know on which path the failure occurred. All invocations to a push need to cleanup with a popProperty(), especially after exceptions.

Parameters:
property - the property which is being followed for embedded indexing
Returns:
this for method chaining.

popProperty

ConversionContext popProperty()
Pops the last pushed property from the stack. See pushIdentifierProperty() and pushProperty(String)}

Returns:
this for method chaining.


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved