All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.api.BeanCacheResult Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebeaninternal.api;

import java.util.ArrayList;
import java.util.List;

/**
 * The results of bean cache hit.
 */
public final class BeanCacheResult {

  private final List> list = new ArrayList<>();

  /**
   * Add an entry.
   */
  public void add(T bean, Object key) {
    list.add(new Entry<>(bean, key));
  }

  /**
   * Return the hits.
   */
  public List> hits() {
    return list;
  }

  /**
   * Bean and cache key pair.
   */
  static final class Entry {

    private final T bean;
    private final Object key;

    public Entry(T bean, Object key) {
      this.bean = bean;
      this.key = key;
    }

    /**
     * Return the natural key or id value.
     */
    public Object key() {
      return key;
    }

    /**
     * Return the bean.
     */
    public T bean() {
      return bean;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy