org.hibernate.search.bridge.util.impl

## Class BridgeAdaptorUtils

- java.lang.Object
- - org.hibernate.search.bridge.util.impl.BridgeAdaptorUtils

-     public final class BridgeAdaptorUtils
      extends Object

  Utilities allowing to take into account bridge adaptors when detecting implemented tagging interface (e.g. `IgnoreAnalyzerBridge`) or when trying to make use of specific field interfaces (e.g. `TwoWayStringBridge`).
  Author:
    Yoann Rodiere

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `unwrapAdaptorAndContainer(Object bridge, Class<T> clazz)` Return a bridge of the specified type extracted from the given bridge, going through `adaptors` and `container bridges` as necessary.
    `static <T> T` | `unwrapAdaptorOnly(Object bridge, Class<T> clazz)` Return a bridge of the specified type extracted from the given bridge, going through `adaptors` as necessary, never going through `container bridges`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### unwrapAdaptorAndContainer

          public static <T> T unwrapAdaptorAndContainer(Object bridge,
                                                        Class<T> clazz)

      Return a bridge of the specified type extracted from the given bridge, going through `adaptors` and `container bridges` as necessary.

      The returned object may be the adaptor itself, or its delegate, or a delegate of its delegate, and so on, but it may also be a element bridge of the given bridge if the given bridge is a `ContainerBridge`, or an element bridge of a delegate of the given bridge, and so on.

      If neither the adaptor nor one of its delegates can provide an instance of the specified type, `null` is returned.

      Parameters:
        `bridge` - The bridge to use as a starting point.
        `clazz` - The expected bridge type.
      Returns:
        A unwrapped bridge implementing the expected bridge type, or `null` if none could be found.

    - #### unwrapAdaptorOnly

          public static <T> T unwrapAdaptorOnly(Object bridge,
                                                Class<T> clazz)

      Return a bridge of the specified type extracted from the given bridge, going through `adaptors` as necessary, never going through `container bridges`.

      The returned object may be the adaptor itself, or its delegate, or a delegate of its delegate, and so on.

      If neither the adaptor or one of its delegates is an instance of the specified type, `null` is returned.

      Parameters:
        `bridge` - The bridge to use as a starting point.
        `clazz` - The expected bridge type.
      Returns:
        A unwrapped bridge implementing the expected bridge type, or `null` if none could be found.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved