Class GuavaCache<K,V>

java.lang.Object
com.github.javaparser.symbolsolver.cache.GuavaCache<K,V>
Type Parameters:
K - The type of the key.
V - The type of the value.
All Implemented Interfaces:
com.github.javaparser.resolution.cache.Cache<K,V>

public class GuavaCache<K,V> extends Object implements com.github.javaparser.resolution.cache.Cache<K,V>
This class is used to wrap a Guava Cache.
  • Constructor Details

    • GuavaCache

      public GuavaCache(com.google.common.cache.Cache<K,V> guavaCache)
  • Method Details

    • create

      public static <expectedK, expectedV> GuavaCache<expectedK, expectedV> create(com.google.common.cache.Cache<expectedK, expectedV> guavaCache)
      Wrap a Guava cache with a custom cache.
      Type Parameters:
      expectedK - The expected type for the key.
      expectedV - The expected type for the value.
      Parameters:
      guavaCache - The guava cache to be wrapped-
      Returns:
      A newly created instance of NoCache.
    • put

      public void put(K key, V value)
      Specified by:
      put in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • get

      public Optional<V> get(K key)
      Specified by:
      get in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • remove

      public void remove(K key)
      Specified by:
      remove in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • contains

      public boolean contains(K key)
      Specified by:
      contains in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • size

      public long size()
      Specified by:
      size in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface com.github.javaparser.resolution.cache.Cache<K,V>
    • stats

      public com.github.javaparser.resolution.cache.CacheStats stats()
      Specified by:
      stats in interface com.github.javaparser.resolution.cache.Cache<K,V>