Class AttributeExtractor

java.lang.Object
com.loomcache.server.query.AttributeExtractor

public final class AttributeExtractor extends Object
Extracts attribute values from map keys and values using reflection.

Supports three access patterns:

  • "__key" — returns the key itself
  • "propertyName" — accesses a JavaBean getter, record component, or Map key on the value
  • "nested.path" — dot-separated property path for nested access

Thread-safe: uses a concurrent cache for resolved accessor methods.

  • Field Details

    • KEY_ATTRIBUTE

      public static final String KEY_ATTRIBUTE
      Special attribute name that returns the key itself.
      See Also:
    • THIS_ATTRIBUTE

      public static final String THIS_ATTRIBUTE
      Special attribute name that returns the value itself.
      See Also:
  • Method Details

    • extract

      public static <K,V> @Nullable Object extract(K key, V value, String attribute)
      Extracts an attribute value from a map entry.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      key - the map entry key
      value - the map entry value
      attribute - the attribute path (e.g., "__key", "name", "address.city")
      Returns:
      the extracted attribute value, or null if not found