org.hibernate.search.elasticsearch.bridge.builtin.impl

## Class ElasticsearchBooleanBridge

- java.lang.Object
- - org.hibernate.search.elasticsearch.bridge.builtin.impl.ElasticsearchBooleanBridge

- All Implemented Interfaces:
    EncodingBridge, IgnoreAnalyzerBridge, StringBridge, TwoWayStringBridge

      public class ElasticsearchBooleanBridge
      extends Object
      implements EncodingBridge, TwoWayStringBridge, IgnoreAnalyzerBridge

  Bridge a boolean field to a `String`.

  Behaves the same as Lucene's BooleanBridge, except the format of indexNullAs strings is checked, so one cannot use a random string as null token.

  Author:
    Sylvain Vieujot, Yoann Rodiere

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ElasticsearchBooleanBridge` | `INSTANCE`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `NullMarker` | `createNullMarker(String indexNullAs)`
    `NumericFieldSettingsDescriptor.NumericEncodingType` | `getEncodingType()` Define the numeric encoding to use for the brdige.
    `String` | `objectToString(Object object)` Converts the object representation to a string.
    `protected Boolean` | `parseIndexNullAs(String indexNullAs)`
    `Boolean` | `stringToObject(String stringValue)` Convert the index string representation to an object.

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final ElasticsearchBooleanBridge INSTANCE

  - ### Method Detail

    - #### stringToObject

          public Boolean stringToObject(String stringValue)

      Description copied from interface: `TwoWayStringBridge`
      Convert the index string representation to an object.
      Specified by:
        `stringToObject` in interface `TwoWayStringBridge`
      Parameters:
        `stringValue` - The index value.
      Returns:
        Takes the string representation from the Lucene index and transforms it back into the original `Object`.

    - #### objectToString

          public String objectToString(Object object)

      Description copied from interface: `StringBridge`
      Converts the object representation to a string.
      Specified by:
        `objectToString` in interface `StringBridge`
      Parameters:
        `object` - The object to transform into a string representation.
      Returns:
        String representation of the given object to be stored in Lucene index. The return string must not be `null`. It can be empty though.

    - #### getEncodingType

          public NumericFieldSettingsDescriptor.NumericEncodingType getEncodingType()

      Description copied from interface: `EncodingBridge`
      Define the numeric encoding to use for the brdige.
      Specified by:
        `getEncodingType` in interface `EncodingBridge`
      Returns:
        the encoding to use for this bridge, or `NumericFieldSettingsDescriptor.NumericEncodingType.UNKNOWN` if this bridge does not use numeric encoding.

    - #### parseIndexNullAs

          protected Boolean parseIndexNullAs(String indexNullAs)
                                      throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

    - #### createNullMarker

          public NullMarker createNullMarker(String indexNullAs)
                                      throws IllegalArgumentException

      Specified by:
        `createNullMarker` in interface `EncodingBridge`
      Parameters:
        `indexNullAs` - The value of `Field.indexNullAs()`.
      Returns:
        The marker to use when a value is missing.
      Throws:
        `IllegalArgumentException` - If `indexNullAs` cannot be encoded in the required format.

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