org.hibernate.search.bridge.builtin

## Enum NumericFieldBridge

- java.lang.Object
- - java.lang.Enum<NumericFieldBridge>
  - - org.hibernate.search.bridge.builtin.NumericFieldBridge

- All Implemented Interfaces:
    Serializable, Comparable<NumericFieldBridge>, FieldBridge, EncodingBridge, IgnoreAnalyzerBridge, StringBridge, TwoWayFieldBridge

      public enum NumericFieldBridge
      extends Enum<NumericFieldBridge>
      implements FieldBridge, TwoWayFieldBridge, EncodingBridge, IgnoreAnalyzerBridge

  Stateless field bridges for the conversion of numbers to numeric field values.
  Author:
    Sanne Grinovero, Gunnar Morling

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `BYTE_FIELD_BRIDGE` Persists byte properties in int index fields.
    `DOUBLE_FIELD_BRIDGE` Persists double properties in double index fields.
    `FLOAT_FIELD_BRIDGE` Persists float properties in float index fields.
    `INT_FIELD_BRIDGE` Persists int properties in int index fields.
    `LONG_FIELD_BRIDGE` Persists long properties in long index fields.
    `SHORT_FIELD_BRIDGE` Persists short properties in int index fields.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `applyToLuceneOptions(LuceneOptions luceneOptions, String name, Number value, Document document)`
    `Object` | `get(String name, Document document)` Build the element object from the `Document`
    `String` | `objectToString(Object object)` Convert the object representation to a string.
    `void` | `set(String name, Object value, Document document, LuceneOptions luceneOptions)` Manipulate the document to index the given value.
    `static NumericFieldBridge` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static NumericFieldBridge[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.hibernate.search.bridge.spi.EncodingBridge

      `createNullMarker, getEncodingType`

- - ### Enum Constant Detail

    - #### BYTE_FIELD_BRIDGE

          public static final NumericFieldBridge BYTE_FIELD_BRIDGE

      Persists byte properties in int index fields. Takes care of all the required conversion.

    - #### SHORT_FIELD_BRIDGE

          public static final NumericFieldBridge SHORT_FIELD_BRIDGE

      Persists short properties in int index fields. Takes care of all the required conversion.

    - #### INT_FIELD_BRIDGE

          public static final NumericFieldBridge INT_FIELD_BRIDGE

      Persists int properties in int index fields. Takes care of all the required conversion.

    - #### FLOAT_FIELD_BRIDGE

          public static final NumericFieldBridge FLOAT_FIELD_BRIDGE

      Persists float properties in float index fields. Takes care of all the required conversion.

    - #### DOUBLE_FIELD_BRIDGE

          public static final NumericFieldBridge DOUBLE_FIELD_BRIDGE

      Persists double properties in double index fields. Takes care of all the required conversion.

    - #### LONG_FIELD_BRIDGE

          public static final NumericFieldBridge LONG_FIELD_BRIDGE

      Persists long properties in long index fields. Takes care of all the required conversion.

  - ### Method Detail

    - #### values

          public static NumericFieldBridge[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (NumericFieldBridge c : NumericFieldBridge.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static NumericFieldBridge valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### set

          public void set(String name,
                          Object value,
                          Document document,
                          LuceneOptions luceneOptions)

      Description copied from interface: `FieldBridge`
      Manipulate the document to index the given value.

      A common implementation is to add a Field with the given `name` to `document` following the parameters `luceneOptions` if the `value` is not `null`.

           String fieldValue = convertToString(value);
           luceneOptions.addFieldToDocument(name, fieldValue, document);

      Specified by:
        `set` in interface `FieldBridge`
      Parameters:
        `name` - The field to add to the Lucene document
        `value` - The actual value to index
        `document` - The Lucene document into which we want to index the value.
        `luceneOptions` - Contains the parameters used for adding `value` to the Lucene document.

    - #### objectToString

          public final String objectToString(Object object)

      Description copied from interface: `TwoWayFieldBridge`
      Convert the object representation to a string.
      Specified by:
        `objectToString` in interface `StringBridge`
      Specified by:
        `objectToString` in interface `TwoWayFieldBridge`
      Parameters:
        `object` - The object to index.
      Returns:
        string (index) representation of the specified object. Must not be `null`, but can be empty.

    - #### get

          public Object get(String name,
                            Document document)

      Description copied from interface: `TwoWayFieldBridge`
      Build the element object from the `Document`
      Specified by:
        `get` in interface `TwoWayFieldBridge`
      Parameters:
        `name` - field name
        `document` - document
      Returns:
        The return value is the entity property value.

    - #### applyToLuceneOptions

          protected void applyToLuceneOptions(LuceneOptions luceneOptions,
                                              String name,
                                              Number value,
                                              Document document)

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