org.hibernate.search.bridge.util.impl

## Class ContextualExceptionBridgeHelper

- java.lang.Object
- - 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

- - ### Property Summary

    All Methods Instance Methods Concrete Methods
    Type | Property and Description
    --- | ---
    `ConversionContext` | `pop` Pops the last pushed property from the stack.
    `ConversionContext` | `pushIdentifier` In case the next conversion fails, the error message will point to the document id of the currently indexed type.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextualExceptionBridgeHelper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected BridgeException` | `buildBridgeException(Exception e, String method, String fieldName, Object bridge)`
    `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 propertyName)` The context has an internal stack for graph navigation.
    `ConversionContext` | `setConvertedTypeId(IndexedTypeIdentifier type)` 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`

- - ### Property Detail

    - #### pop

          public ConversionContext popProperty

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

    - #### pushIdentifier

          public ConversionContext pushIdentifierProperty

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

  - ### Constructor Detail

    - #### ContextualExceptionBridgeHelper

          public ContextualExceptionBridgeHelper()

  - ### Method Detail

    - #### setConvertedTypeId

          public ConversionContext setConvertedTypeId(IndexedTypeIdentifier type)

      Description copied from interface: `ConversionContext`
      In case the next conversion fails, the error message will point to this type.
      Specified by:
        `setConvertedTypeId` in interface `ConversionContext`
      Parameters:
        `type` - the type which is going to be converted
      Returns:
        this for method chaining.

    - #### pushProperty

          public ConversionContext pushProperty(String propertyName)

      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:
        `propertyName` - the name of 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,
                                                         String fieldName,
                                                         Object bridge)

    - #### 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-2017 Red Hat, Inc. All Rights Reserved