Module nl.jqno.equalsverifier
Class CachingValueProvider
java.lang.Object
nl.jqno.equalsverifier.internal.valueproviders.CachingValueProvider
- All Implemented Interfaces:
ValueProvider
Provides cached instances of classes. On a cache miss, a value is requested from the given fallback ValueProvider. If
it returns a value, this value is cached.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ValueProviderprivate final FieldCacheprivate final UserPrefabValueCaches -
Constructor Summary
ConstructorsConstructorDescriptionCachingValueProvider(UserPrefabValueCaches decider, FieldCache fieldCache, ValueProvider fallback) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprovide(TypeTag tag, Attributes attributes) Returns a tuple of two different prefabricated values of the specified type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nl.jqno.equalsverifier.internal.valueproviders.ValueProvider
provideOrThrow
-
Field Details
-
prefabCaches
-
fieldCache
-
fallback
-
-
Constructor Details
-
CachingValueProvider
public CachingValueProvider(UserPrefabValueCaches decider, FieldCache fieldCache, ValueProvider fallback) Constructor.- Parameters:
decider- Decides whether a value should be cached or not.fieldCache- The underlying cache of instances.fallback- The ValueProvider that provides instances when there's a cache miss.
-
-
Method Details
-
provide
Returns a tuple of two different prefabricated values of the specified type.- Specified by:
providein interfaceValueProvider- Type Parameters:
T- The returned tuple will have this generic type.- Parameters:
tag- A description of the desired type, including generic parameters.attributes- The attributes of the field that the provided values must be linked to.- Returns:
- A tuple of two different values of the given type, or an empty Optional if none could be found.
-