Interface DerivedAttributeLoader<T>

Type Parameters:
T - type of the loaded value
All Superinterfaces:
AttributeLoader<T>
All Known Implementing Classes:
AbstractDerivedAttributeLoader, BaseDerivedAttributeLoader, BiDerivedAttributeLoaderBuilder.BuiltBiDerivedLoader, DelegatingDerivedAttributeLoader, SimpleDerivedAttributeLoader, UniDerivedAttributeLoaderBuilder.BuiltDerivedLoader

@PublicSpi public interface DerivedAttributeLoader<T> extends AttributeLoader<T>

Derived loaders calculate the attribute value based only on the attribute dependencies. The dependencies are loaded by some other loaders and may be item or row based, or they may be other derived attributes.

Values calculated by derived attribute loaders are stored in the per-item cache only if they depend on other per-item attributes, otherwise they are stored in the per-forest cache.

The loader must be a stable function, based on the dependency values. It must not depend on any other inputs, and should provide the same result for the same inputs every time: V(row) = DERIVED(dependencies(row)).

See Also:
  • Method Details

    • loadValue

      @Nullable AttributeValue<T> loadValue(@NotNull DerivedAttributeContext context)

      Performs the loading.

      If the value is missing or empty, the loader should return AttributeValue.undefined(). If for some reason this loader is not applicable for the given row, it should return null.

      Parameters:
      context - loading context
      Returns:
      the calculated value