Class MapNamedValues

java.lang.Object
org.hibernate.search.engine.search.common.spi.MapNamedValues
All Implemented Interfaces:
NamedValues
Direct Known Subclasses:
QueryParameters

@Incubating public class MapNamedValues extends Object implements NamedValues
  • Field Details

  • Constructor Details

  • Method Details

    • fromMap

      public static NamedValues fromMap(Map<String,Object> map, Function<String,org.hibernate.search.util.common.SearchException> namedValueMissing)
      Create a simple instance of NamedValues backed by a map.
      Parameters:
      map - The map with values.
      namedValueMissing - A function that returns an exception for the name if the value is missing.
    • get

      public <T> T get(String name, Class<T> paramType)
      Specified by:
      get in interface NamedValues
      Type Parameters:
      T - The expected type of the value.
      Parameters:
      name - The name of the value.
      paramType - The expected type of the parameter.
      Returns:
      The value with the given name.
    • getOptional

      public <T> Optional<T> getOptional(String name, Class<T> paramType)
      Specified by:
      getOptional in interface NamedValues
      Type Parameters:
      T - The expected type of the value.
      Parameters:
      name - The name of the value.
      paramType - The expected type of the parameter.
      Returns:
      An optional containing the value with the given name, or Optional.empty() if there is none.