org.hibernate.search.bridge.builtin

## Class NumericEncodingCalendarBridge

- java.lang.Object
- - org.hibernate.search.bridge.builtin.NumericEncodingDateBridge
  - - org.hibernate.search.bridge.builtin.NumericEncodingCalendarBridge

- All Implemented Interfaces:
    FieldBridge, ParameterizedBridge, EncodingBridge, IgnoreAnalyzerBridge, StringBridge, TwoWayFieldBridge

      public class NumericEncodingCalendarBridge
      extends NumericEncodingDateBridge

  Bridge a `java.util.Date` truncated to the specified resolution to a numerically indexed `long`. GMT is used as time zone.
  - Resolution.YEAR: yyyy
  - Resolution.MONTH: yyyyMM
  - Resolution.DAY: yyyyMMdd
  - Resolution.HOUR: yyyyMMddHH
  - Resolution.MINUTE: yyyyMMddHHmm
  - Resolution.SECOND: yyyyMMddHHmmss
  - Resolution.MILLISECOND: yyyyMMddHHmmssSSS
  Author:
    Emmanuel Bernard, Hardy Ferentschik

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TwoWayFieldBridge` | `DATE_DAY`
    `static TwoWayFieldBridge` | `DATE_HOUR`
    `static TwoWayFieldBridge` | `DATE_MILLISECOND`
    `static TwoWayFieldBridge` | `DATE_MINUTE`
    `static TwoWayFieldBridge` | `DATE_MONTH`
    `static TwoWayFieldBridge` | `DATE_SECOND`
    `static TwoWayFieldBridge` | `DATE_YEAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumericEncodingCalendarBridge()`
    `NumericEncodingCalendarBridge(Resolution resolution)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

    - ### Methods inherited from class org.hibernate.search.bridge.builtin.NumericEncodingDateBridge

      `createNullMarker, getEncodingType, getResolution, setParameterValues`

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

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

- - ### Field Detail

    - #### DATE_YEAR

          public static final TwoWayFieldBridge DATE_YEAR

    - #### DATE_MONTH

          public static final TwoWayFieldBridge DATE_MONTH

    - #### DATE_DAY

          public static final TwoWayFieldBridge DATE_DAY

    - #### DATE_HOUR

          public static final TwoWayFieldBridge DATE_HOUR

    - #### DATE_MINUTE

          public static final TwoWayFieldBridge DATE_MINUTE

    - #### DATE_SECOND

          public static final TwoWayFieldBridge DATE_SECOND

    - #### DATE_MILLISECOND

          public static final TwoWayFieldBridge DATE_MILLISECOND

  - ### Constructor Detail

    - #### NumericEncodingCalendarBridge

          public NumericEncodingCalendarBridge()

    - #### NumericEncodingCalendarBridge

          public NumericEncodingCalendarBridge(Resolution resolution)

  - ### Method Detail

    - #### 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`
      Overrides:
        `get` in class `NumericEncodingDateBridge`
      Parameters:
        `name` - field name
        `document` - document
      Returns:
        The return value is the entity property value.

    - #### objectToString

          public 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`
      Overrides:
        `objectToString` in class `NumericEncodingDateBridge`
      Parameters:
        `object` - The object to index.
      Returns:
        string (index) representation of the specified object. Must not be `null`, but can be empty.

    - #### 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`
      Overrides:
        `set` in class `NumericEncodingDateBridge`
      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.

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