Package org.eclipse.handly.model.impl.support

# Interface IBodyCache

public interface IBodyCache
Represents a cache of element handle/body relationships.

See Also:
  - `IElement`
  - `Body`
  - `ElementManager`
  - `ElementCache`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `get(IElement element)`
  Returns the corresponding body for the given element, or `null` if this cache contains no body for the element.
  `Object`
  `peek(IElement element)`
  Returns the corresponding body for the given element without disturbing cache ordering, or `null` if this cache contains no body for the element.
  `void`
  `put(IElement element, Object body)`
  Remembers the given body for the given element in this cache.
  `default void`
  `putAll(Map<? extends IElement,Object> elementBodies)`
  Remembers the given element handle/body relationships in this cache.
  `void`
  `remove(IElement element)`
  Removes the corresponding body for the given element from this cache.

- ## Method Details

  - ### get

    Object get(IElement element)
    Returns the corresponding body for the given element, or `null` if this cache contains no body for the element.
    Parameters:
      `element` - the element whose body is to be returned
    Returns:
      the corresponding body for the given element, or `null` if the cache contains no body for the element

  - ### peek

    Object peek(IElement element)
    Returns the corresponding body for the given element without disturbing cache ordering, or `null` if this cache contains no body for the element.
    Parameters:
      `element` - the element whose body is to be returned
    Returns:
      the corresponding body for the given element, or `null` if the cache contains no body for the element

  - ### put

    void put(IElement element, Object body)
    Remembers the given body for the given element in this cache. If the cache previously contained a body for the element, the old body is replaced with the given body.
    Parameters:
      `element` - the element with which the given body is to be associated (not `null`)
      `body` - the body to be associated with the given element (not `null`)

  - ### putAll

    default void putAll(Map<? extends IElement,Object> elementBodies)
    Remembers the given element handle/body relationships in this cache.
    Parameters:
      `elementBodies` - element handle/body relationships to be stored in the cache (not `null`)

  - ### remove

    void remove(IElement element)
    Removes the corresponding body for the given element from this cache. Does nothing if the cache contains no body for the element.
    Parameters:
      `element` - the element whose body is to be removed from the cache