Class UserPrefabValueCaches

java.lang.Object
nl.jqno.equalsverifier.internal.valueproviders.UserPrefabValueCaches

public class UserPrefabValueCaches extends Object
Contains various caches of prefab values, or of factories for prefab values.
  • Field Details

  • Constructor Details

    • UserPrefabValueCaches

      public UserPrefabValueCaches()
      Constructor.
    • UserPrefabValueCaches

      private UserPrefabValueCaches(UserPrefabValueCaches other)
      Private copy constructor.
      Parameters:
      other - The
      invalid reference
      GenericPrefabValueProvider
      to copy.
  • Method Details

    • copy

      public UserPrefabValueCaches copy()
      Copies the cache of this PrefabValueProvider into a new instance.
      Returns:
      A copy of this PrefabValueProvider.
    • register

      public <T> void register(Class<T> type, T red, T blue, T redCopy)
      Registers a prefab value.
      Type Parameters:
      T - The type of the instances.
      Parameters:
      type - The class of the prefabricated values.
      red - An instance of T.
      blue - Another instance of T, not equal to red.
      redCopy - An instance of T, equal to red but preferably not the same instance.
    • registerResettable

      public <T> void registerResettable(Class<T> type, Supplier<T> red, Supplier<T> blue, Supplier<T> redCopy)
      Registers a resettable prefab value.
      Type Parameters:
      T - The type of the instances.
      Parameters:
      type - The class of the prefabricated values.
      red - A Supplier for an instance of T.
      blue - A Supplier for another instance of T, not equal to red.
      redCopy - A Supplier for an instance of T, equal to red but preferably not the same instance.
    • registerGeneric

      public <T> void registerGeneric(Class<T> type, Func.Func1<?,T> factory)
      Registers a generic prefab value of arity 1.
      Type Parameters:
      T - The class of the prefabricated value.
      Parameters:
      type - The class of the prefabricated value.
      factory - A factory that can turn generic values into an instance of type with the appropriate generic values.
    • registerGeneric

      public <T> void registerGeneric(Class<T> type, Func.Func2<?,?,T> factory)
      Registers a generic prefab value of arity 2.
      Type Parameters:
      T - The class of the prefabricated value.
      Parameters:
      type - The class of the prefabricated value.
      factory - A factory that can turn generic values into an instance of type with the appropriate generic values.
    • getPlain

      public Tuple<?> getPlain(Class<?> type)
      Retrieves a tuple of prefabricated values from the regular cache.
      Parameters:
      type - The type of the desired prefabricated values.
      Returns:
      A tuple of prefabricated values.
    • getResettable

      public Tuple<Supplier<?>> getResettable(Class<?> type)
      Retrieves a resettable tuple of prefabricated values from the regular cache.
      Parameters:
      type - The type of the desired prefabricated values.
      Returns:
      A resettable tuple of prefabricated values.
    • getGeneric

      public <T> Func<T> getGeneric(Class<T> type)
      Retrieves a factory to construct prefabricated values from the generic cache.
      Type Parameters:
      T - The type of the desired prefabricated values.
      Parameters:
      type - The type of the desired prefabricated values.
      Returns:
      A factory to construct prefabricated values.
    • canBeCached

      public boolean canBeCached(Class<?> type)
      Whether instances of type should be cached.
      Parameters:
      type - The type whose instances should or should not be cached.
      Returns:
      Whether or not the given type should be cached.