Class DefaultYearBridge

java.lang.Object
org.hibernate.search.mapper.pojo.bridge.builtin.impl.DefaultYearBridge
All Implemented Interfaces:
AutoCloseable, IdentifierBridge<Year>, ValueBridge<Year,Year>

public final class DefaultYearBridge extends Object
  • Field Details

  • Method Details

    • toString

      protected String toString(Year value)
    • fromString

      protected Year fromString(String value)
    • toIndexedValue

      public final Year toIndexedValue(Year value, ValueBridgeToIndexedValueContext context)
      Description copied from interface: ValueBridge
      Transform the given POJO-extracted value into the value of the indexed field.
      Parameters:
      value - The POJO-extracted value to be transformed.
      context - A context that can be extended to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).
      Returns:
      The value of the indexed field.
    • fromIndexedValue

      public final Year fromIndexedValue(Year value, ValueBridgeFromIndexedValueContext context)
      Description copied from interface: ValueBridge
      Transform the given indexed field value to the corresponding POJO-extracted value.
      Parameters:
      value - The value of the indexed field to be transformed.
      context - A context that can be extended to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).
      Returns:
      The POJO-extracted value.
    • parse

      public final Year parse(String value)
      Description copied from interface: ValueBridge
      Parse an input String to the raw index field value.
      Parameters:
      value - The value to parse.
      Returns:
      The raw index field value.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public final void close()
      Description copied from interface: ValueBridge
      Close any resource before the bridge is discarded.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface IdentifierBridge<V>
      Specified by:
      close in interface ValueBridge<V,F>
    • toDocumentIdentifier

      public final String toDocumentIdentifier(Year propertyValue, IdentifierBridgeToDocumentIdentifierContext context)
      Description copied from interface: IdentifierBridge
      Transform the given POJO property value to the value of the document identifier.

      Must return a unique value for each value of propertyValue

      Specified by:
      toDocumentIdentifier in interface IdentifierBridge<V>
      Parameters:
      propertyValue - The POJO property value to be transformed.
      context - A context that can be extended to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).
      Returns:
      The value of the document identifier.
    • fromDocumentIdentifier

      public final Year fromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)
      Description copied from interface: IdentifierBridge
      Transform the given document identifier value back to the value of the POJO property.

      Must be the exact inverse function of IdentifierBridge.toDocumentIdentifier(Object, IdentifierBridgeToDocumentIdentifierContext), i.e. object.equals(fromDocumentIdentifier(toDocumentIdentifier(object, sessionContext))) must always be true.

      Specified by:
      fromDocumentIdentifier in interface IdentifierBridge<V>
      Parameters:
      documentIdentifier - The document identifier value to be transformed.
      context - A sessionContext that can be extended to a more useful type, giving access to such things as a Hibernate ORM Session (if using the Hibernate ORM mapper).
      Returns:
      The value of the document identifier.
    • parseIdentifierLiteral

      public Year parseIdentifierLiteral(String value)
      Description copied from interface: IdentifierBridge
      Transform the given document identifier string value back to the value of the POJO property.
      Specified by:
      parseIdentifierLiteral in interface IdentifierBridge<V>
      Parameters:
      value - The value to parse.
      Returns:
      The raw index field value.
    • isCompatibleWith

      public boolean isCompatibleWith(IdentifierBridge<?> other)
      Specified by:
      isCompatibleWith in interface IdentifierBridge<V>
    • isCompatibleWith

      public boolean isCompatibleWith(ValueBridge<?,?> other)
      Specified by:
      isCompatibleWith in interface ValueBridge<V,F>
      Parameters:
      other - Another ValueBridge, never null.
      Returns:
      true if the given object is also a ValueBridge that behaves exactly the same as this object, i.e. its ValueBridge.toIndexedValue(Object, ValueBridgeToIndexedValueContext) method is guaranteed to accept the same values as this object's and to always return the same value as this object's when given the same input. false otherwise, or when in doubt.