Interface AttributeLoaderContext

All Superinterfaces:
AttributeContext
All Known Subinterfaces:
AggregateAttributeContext, DerivedAttributeContext, ItemAttributeContext, PropagateAttributeContext, RowAttributeContext, ScanningAttributeContext, SingleRowAttributeContext

@PublicApi public interface AttributeLoaderContext extends AttributeContext

This interface adds methods to AttributeContext that are used only by attribute loaders.

Each type of attribute loader will receive a more specific type of context with additional methods based on what that type of loaders might need.

See Also:
  • Method Details

    • getDependencyAttributeValue

      @NotNull <V> AttributeValue<V> getDependencyAttributeValue(@NotNull AttributeSpec<V> dependency)

      Gets the value of dependency attribute for the row being calculated.

      The loader must declare the dependency in order to get its value here. The attribute system guarantees that the dependency attributes are loaded first.

      Type Parameters:
      V - type of the value
      Parameters:
      dependency - attribute spec of the dependency
      Returns:
      value of the dependency, as AttributeValue wrapper
      Throws:
      IllegalArgumentException - if the dependency attribute was not declared
      See Also:
    • getDependencyValue

      @Nullable default <V> V getDependencyValue(@NotNull AttributeSpec<V> dependency)

      Gets the value of dependency attribute for the row being calculated.

      The loader must declare the dependency in order to get its value here. The attribute system guarantees that the dependency attributes are loaded first.

      Type Parameters:
      V - type of the value
      Parameters:
      dependency - attribute spec of the dependency
      Returns:
      value of the dependency
      Throws:
      IllegalArgumentException - if the dependency attribute was not declared
      See Also:
    • addTrail

      void addTrail(@Nullable TrailItemSet trail)

      Used to indicate the trail of the value being calculated.

      A trail is an additional set of items that were used to produce the value for the currently calculated row or item. It is important to indicate the trail because when those additional items change, we need to recalculate this value.

      For example, if we calculate the display name of the issue's assignee, we use the corresponding "user" object. Even if the issue's assignee does not later change, the user's display name might, so in order to catch that and recalculate the value, we need add the user item as the trail for this value.

      Attribute loaders are required to declare AttributeContextDependency.TRAIL to use this method.

      Parameters:
      trail - the set of items used to calculate this value
    • addTrail

      default void addTrail(@Nullable ItemIdentity item)

      Used to indicate the trail of the value being calculated.

      Attribute loaders are required to declare AttributeContextDependency.TRAIL to use this method.

      Parameters:
      item - a single item that was used to calculate this value
      See Also:
    • valueExpires

      void valueExpires(long ttl, @NotNull TimeUnit unit)

      Calling this method makes the value being currently calculated expire by timeout. When the value expires, it becomes outdated and will be recalculated the next time it is requested.

      Any value that depends on one or more expiring values will also have an expiration time equal to the earliest expiration time of its dependencies.

      Calling this method multiple times will result in the earliest expiration time being used.

      Attribute loaders are required to declare AttributeContextDependency.CURRENT_TIME to use this method.

      If CURRENT_TIME context dependency is declared, but valueExpires() is not called, a default expiration period will be used. It is set to 30 seconds and can be changed via setting structure.attribute.timedValueRefresh dark feature (in milliseconds).

      Parameters:
      ttl - amount of time after which the currently calculated value should expire, must be a positive number
      unit - time unit
      Throws:
      IllegalArgumentException - if ttl <= 0
      See Also: