Class PojoModelPath

java.lang.Object
org.hibernate.search.mapper.pojo.model.path.PojoModelPath
Direct Known Subclasses:
PojoModelPathPropertyNode, PojoModelPathValueNode

public abstract class PojoModelPath extends Object
Represents an arbitrarily long access path when walking the POJO model.

For instance the path could be: property "propertyOfA" => extractor "MapValueExtractor" => property "propertyOfB" Meaning: extract property "propertyOfA", then extract values using "MapValueExtractor", then for each value extract property "propertyOfB".

  • Field Details

    • DOT_PATTERN

      protected static final Pattern DOT_PATTERN
  • Method Details

    • builder

      public static PojoModelPath.Builder builder()
      Returns:
      A builder allowing to create a PojoModelPath by specifying its components (property, container extractors) one by one.
    • ofProperty

      public static PojoModelPathPropertyNode ofProperty(String propertyName)
      Parameters:
      propertyName - The name of a POJO property.
      Returns:
      A path from a POJO to the property with the given name.
    • ofValue

      public static PojoModelPathValueNode ofValue(String propertyName)
      Parameters:
      propertyName - The name of a POJO property.
      Returns:
      A PojoModelPath from a POJO to the value(s) of the property with the given name. Default container extractors are applied to the property, so that for example a path to a List property will in fact point to the elements of that list.
    • ofValue

      public static PojoModelPathValueNode ofValue(String propertyName, ContainerExtractorPath extractorPath)
      Parameters:
      propertyName - The name of a POJO property.
      extractorPath - A container extractor path.
      Returns:
      A PojoModelPath from a POJO to the value(s) of the property with the given name. The extractors represented by the given extractor path are applied to the property, so that for example a path to a List property may in fact point to the elements of that list.
    • parse

      public static PojoModelPathValueNode parse(String dotSeparatedPath)
      Parameters:
      dotSeparatedPath - A dot-separated path, such as "myProperty.someNestedProperty".
      Returns:
      A PojoModelPath representing the same path, which the default container extractors applied to each property, so that for example a path to a List property will in fact point to the elements of that list.
    • toString

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

      public final String toPathString()
      Returns:
      A representation of this path in the form propertyA<containerExtractorPathA>.propertyB<containerExtractorPathB>.propertyC<containerExtractorPathB>.
    • parent

      public abstract PojoModelPath parent()
      Returns:
      The model path to the element from which the value represented by this node is extracted. May be null.