Class UserPrefabValueProvider

java.lang.Object
nl.jqno.equalsverifier.internal.valueproviders.UserPrefabValueProvider
All Implemented Interfaces:
ValueProvider

public class UserPrefabValueProvider extends Object implements ValueProvider
Provider of prefabricated instances of classes that have been provided by the user. Note that this only works for non-generic classes, because this ValueProvider can't determine the generic types or get values for them. For that, we either need withPrefabValuesForField, or the complicated recursion mechanism that is currently provided by VintageValueProvider.
  • Field Details

  • Constructor Details

    • UserPrefabValueProvider

      public UserPrefabValueProvider(UserPrefabValueCaches caches)
      Constructor.
      Parameters:
      caches - The caches that this provider draws from.
  • Method Details

    • copy

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

      public <T> Optional<Tuple<T>> provide(TypeTag tag, Attributes attributes)
      Returns a tuple of two different prefabricated values of the specified type.
      Specified by:
      provide in interface ValueProvider
      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.
    • attempt

      private <T> Tuple<T> attempt(Class<?> type)