Class TypePool.CacheProvider.Simple

    • Field Detail

      • storage

        private final java.util.concurrent.ConcurrentMap<java.lang.String,​TypePool.Resolution> storage
        A map containing all cached resolutions by their names.
    • Constructor Detail

      • Simple

        public Simple()
        Creates a new simple cache.
      • Simple

        public Simple​(java.util.concurrent.ConcurrentMap<java.lang.String,​TypePool.Resolution> storage)
        Creates a new simple cache.
        Parameters:
        storage - A map that is used for locating and storing resolutions.
    • Method Detail

      • withObjectType

        public static TypePool.CacheProvider withObjectType()
        Returns a simple cache provider that is prepopulated with the Object type.
        Returns:
        A simple cache provider that is prepopulated with the Object type.
      • find

        public TypePool.Resolution find​(java.lang.String name)
        Attempts to find a resolution in this cache.
        Specified by:
        find in interface TypePool.CacheProvider
        Parameters:
        name - The name of the type to describe.
        Returns:
        A resolution of the type or null if no such resolution can be found in the cache..
      • register

        public TypePool.Resolution register​(java.lang.String name,
                                            TypePool.Resolution resolution)
        Registers a resolution in this cache. If a resolution to the given name already exists in the cache, it should be discarded.
        Specified by:
        register in interface TypePool.CacheProvider
        Parameters:
        name - The name of the type that is to be registered.
        resolution - The resolution to register.
        Returns:
        The oldest version of a resolution that is currently registered in the cache which might be the given resolution or another resolution that was previously registered.
      • getStorage

        public java.util.concurrent.ConcurrentMap<java.lang.String,​TypePool.Resolution> getStorage()
        Returns the underlying storage map of this simple cache provider.
        Returns:
        A map containing all cached resolutions by their names.