Class PrefabValues
java.lang.Object
nl.jqno.equalsverifier.internal.prefabvalues.PrefabValues
Container and creator of prefabricated instances of objects and classes.
Only creates values ones, and caches them once they've been created. Takes generics into
account; i.e., List<Integer>
is different from List<String>
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
Returns the "blue" prefabricated value of the specified type.<T> T
Returns a prefabricated value of the specified type, that is different from the specified value.<T> T
giveOther
(TypeTag tag, T value, LinkedHashSet<TypeTag> typeStack) Returns a prefabricated value of the specified type, that is different from the specified value.<T> T
Returns the "red" prefabricated value of the specified type.<T> T
giveRedCopy
(TypeTag tag) Returns a shallow copy of the "red" prefabricated value of the specified type.<T> Tuple
<T> Returns a tuple of two different prefabricated values of the specified type.<T> Tuple
<T> giveTuple
(TypeTag tag, LinkedHashSet<TypeTag> typeStack) Returns a tuple of two different prefabricated values of the specified type.<T> void
realizeCacheFor
(TypeTag tag, LinkedHashSet<TypeTag> typeStack) Makes sure that values for the specified type are present in the cache, but doesn't return them.
-
Constructor Details
-
PrefabValues
Constructor.- Parameters:
factoryCache
- The factories that can be used to create values.
-
-
Method Details
-
giveRed
Returns the "red" prefabricated value of the specified type.It's always a different value from the "blue" one.
- Type Parameters:
T
- The return value is cast to this type.- Parameters:
tag
- A description of the desired type, including generic parameters.- Returns:
- The "red" prefabricated value.
-
giveBlue
Returns the "blue" prefabricated value of the specified type.It's always a different value from the "red" one.
- Type Parameters:
T
- The return value is cast to this type.- Parameters:
tag
- A description of the desired type, including generic parameters.- Returns:
- The "blue" prefabricated value.
-
giveRedCopy
Returns a shallow copy of the "red" prefabricated value of the specified type.When possible, it's equal to but not the same as the "red" object.
- Type Parameters:
T
- The return value is cast to this type.- Parameters:
tag
- A description of the desired type, including generic parameters.- Returns:
- A shallow copy of the "red" prefabricated value.
-
giveTuple
Returns a tuple of two different prefabricated values of the specified type.- Type Parameters:
T
- The returned tuple will have this generic type.- Parameters:
tag
- A description of the desired type, including generic parameters.- Returns:
- A tuple of two different values of the given type.
-
giveTuple
Returns a tuple of two different prefabricated values of the specified type.- Type Parameters:
T
- The returned tuple will have this generic type.- Parameters:
tag
- A description of the desired type, including generic parameters.typeStack
- Keeps track of recursion in the type.- Returns:
- A tuple of two different values of the given type.
-
giveOther
Returns a prefabricated value of the specified type, that is different from the specified value.- Type Parameters:
T
- The type of the value.- Parameters:
tag
- A description of the desired type, including generic parameters.value
- A value that is different from the value that will be returned.- Returns:
- A value that is different from
value
.
-
giveOther
Returns a prefabricated value of the specified type, that is different from the specified value.- Type Parameters:
T
- The type of the value.- Parameters:
tag
- A description of the desired type, including generic parameters.value
- A value that is different from the value that will be returned.typeStack
- Keeps track of recursion in the type.- Returns:
- A value that is different from
value
.
-
realizeCacheFor
Makes sure that values for the specified type are present in the cache, but doesn't return them.- Type Parameters:
T
- The desired type.- Parameters:
tag
- A description of the desired type, including generic parameters.typeStack
- Keeps track of recursion in the type.
-