org.hibernate.search.bridge.util.impl
Class ContextualExceptionBridgeHelper

java.lang.Object
  extended by org.hibernate.search.bridge.util.impl.ContextualExceptionBridgeHelper
All Implemented Interfaces:
ConversionContext

public final class ContextualExceptionBridgeHelper
extends Object
implements ConversionContext

Wrap the exception with an exception provide contextual feedback. This class is designed to be reused, but is not threadsafe.

Author:
Emmanuel Bernard, Sanne Grinovero, Hardy Ferentschik

Constructor Summary
ContextualExceptionBridgeHelper()
           
 
Method Summary
protected  BridgeException buildBridgeException(Exception e, String method)
           
 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<?> clazz)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextualExceptionBridgeHelper

public ContextualExceptionBridgeHelper()
Method Detail

setClass

public ConversionContext setClass(Class<?> clazz)
Description copied from interface: ConversionContext
In case the next conversion fails, the error message will point to this type.

Specified by:
setClass in interface ConversionContext
Parameters:
clazz - the class type which is going to be converted
Returns:
this for method chaining.

pushProperty

public ConversionContext pushProperty(String property)
Description copied from interface: ConversionContext
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 ConversionContext.popProperty(), especially after exceptions.

Specified by:
pushProperty in interface ConversionContext
Parameters:
property - the property which is being followed for embedded indexing
Returns:
this for method chaining.

popProperty

public ConversionContext popProperty()
Description copied from interface: ConversionContext
Pops the last pushed property from the stack. See ConversionContext.pushIdentifierProperty() and ConversionContext.pushProperty(String)}

Specified by:
popProperty in interface ConversionContext
Returns:
this for method chaining.

pushIdentifierProperty

public ConversionContext pushIdentifierProperty()
Description copied from interface: ConversionContext
In case the next conversion fails, the error message will point to the document id of the currently indexed type.

Specified by:
pushIdentifierProperty in interface ConversionContext
Returns:
this for method chaining.

buildBridgeException

protected BridgeException buildBridgeException(Exception e,
                                               String method)

oneWayConversionContext

public FieldBridge oneWayConversionContext(FieldBridge delegate)
Description copied from interface: ConversionContext
Decorates a FieldBridge.

Specified by:
oneWayConversionContext in interface ConversionContext
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

public TwoWayFieldBridge twoWayConversionContext(TwoWayFieldBridge delegate)
Description copied from interface: ConversionContext
Decorates a TwoWayFieldBridge.

Specified by:
twoWayConversionContext in interface ConversionContext
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

public StringBridge stringConversionContext(StringBridge delegate)
Description copied from interface: ConversionContext
Decorates a StringBridge.

Specified by:
stringConversionContext in interface ConversionContext
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.


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