Interface ModelCacheTag<T>

Type Parameters:
T - The type of data associated with the tag.

interface ModelCacheTag<T>
Describes a tag used by the model builder to access a ModelCache. This interface basically aggregates a name and a class to provide some type safety when working with the otherwise untyped cache.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The tag used to denote an effective dependency management section from an imported model.
    static final ModelCacheTag<ModelData>
    The tag used to denote raw model data.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromCache(T data)
    Creates a copy of the data suitable for retrieval from the cache.
    Gets the name of the tag.
    Gets the type of data associated with this tag.
    intoCache(T data)
    Creates a copy of the data suitable for storage in the cache.
  • Field Details

  • Method Details

    • getName

      String getName()
      Gets the name of the tag.
      Returns:
      The name of the tag, must not be null.
    • getType

      Class<T> getType()
      Gets the type of data associated with this tag.
      Returns:
      The type of data, must not be null.
    • intoCache

      T intoCache(T data)
      Creates a copy of the data suitable for storage in the cache. The original data to store can be mutated after the cache is populated but the state of the cache must not change so we need to make a copy.
      Parameters:
      data - The data to store in the cache, must not be null.
      Returns:
      The data being stored in the cache, never null.
    • fromCache

      T fromCache(T data)
      Creates a copy of the data suitable for retrieval from the cache. The retrieved data can be mutated after the cache is queried but the state of the cache must not change so we need to make a copy.
      Parameters:
      data - The data to retrieve from the cache, must not be null.
      Returns:
      The data being retrieved from the cache, never null.