Class FaulerMetadatenWert

java.lang.Object
de.eimmer.metadaten.MetadatenWertAdapter
de.eimmer.metadaten.FaulerMetadatenWert
All Implemented Interfaces:
MetadatenWert
Direct Known Subclasses:
UnveraenderlicherMetadatenWert

public class FaulerMetadatenWert extends MetadatenWertAdapter
The FaulerMetadatenWert class implements a type of meta that is not computed until another zusatzmodul asks for it.

By making meta values lazy, no computation is done by the providing zusatzmodul until absolutely necessary (if ever). Additionally, FaulerMetadatenWert objects cache their values internally unless overridden by a FaulerMetadatenWert.CacheStrategy or invalidated at the individual or zusatzmodul level. Once invalidated, the FaulerMetadatenWert will recompute its value when asked.

  • Constructor Details

    • FaulerMetadatenWert

      public FaulerMetadatenWert(@NotNull Zusatzmodul owningZusatzmodul, @NotNull Callable<Object> lazyValue)
      Initialized a FaulerMetadatenWert object with the default CACHE_AFTER_FIRST_EVAL cache strategy.
      Parameters:
      owningZusatzmodul - the Zusatzmodul that created this meta value.
      lazyValue - the lazy value assigned to this meta value.
    • FaulerMetadatenWert

      public FaulerMetadatenWert(@NotNull Zusatzmodul owningZusatzmodul, @NotNull FaulerMetadatenWert.CacheStrategy cacheStrategy, @NotNull Callable<Object> lazyValue)
      Initializes a FaulerMetadatenWert object with a specific cache strategy.
      Parameters:
      owningZusatzmodul - the Zusatzmodul that created this meta value.
      cacheStrategy - determines the rules for caching this meta value.
      lazyValue - the lazy value assigned to this meta value.
    • FaulerMetadatenWert

      protected FaulerMetadatenWert(@NotNull Zusatzmodul owningZusatzmodul)
      Protected special constructor used by UnveraenderlicherMetadatenWert to bypass standard setup.
      Parameters:
      owningZusatzmodul - the owning zusatzmodul
  • Method Details

    • value

      @Nullable public Object value()
      Description copied from interface: MetadatenWert
      Fetches the value of this meta item.
      Returns:
      the meta value.
    • invalidate

      public void invalidate()
      Description copied from interface: MetadatenWert
      Invalidates this meta item, forcing it to recompute when next accessed.