java.lang.Object
nl.jqno.equalsverifier.internal.reflection.FieldCache
Contains a cache for values connected to specific fields, for
SubjectCreator.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<FieldCache.Key, Tuple<?>> We store Strings instead of Fields, to make it easier to interact with when we don't actually have a reference to a Field. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether values are available for the given field.<T> Tuple<T> Retrieves the values from the cache for the given field.Returns the fields preset in the cache.<T> voidAdds the given factory to the cache and associates it with the given type.
-
Field Details
-
cache
We store Strings instead of Fields, to make it easier to interact with when we don't actually have a reference to a Field.
-
-
Constructor Details
-
FieldCache
public FieldCache()
-
-
Method Details
-
put
Adds the given factory to the cache and associates it with the given type.- Type Parameters:
T- The type of the values.- Parameters:
fieldName- The name of the field to associate with the values.fieldType- The type of the field to associate with the values.tuple- The tuple that contains the values.
-
get
Retrieves the values from the cache for the given field.What happens when there are no values, is undefined. Always call
contains(String, TypeTag)first.- Type Parameters:
T- The returned values will have this as generic type.- Parameters:
fieldName- The name of the field for which values are needed.fieldType- The type of the field for which values are needed.- Returns:
- A tuple of values for the given type, or
nullif none is available.
-
contains
Returns whether values are available for the given field.- Parameters:
fieldName- The name of the field for which values are needed.fieldType- The type of the field for which values are needed.- Returns:
- Whether values are available for the given field.
-
getFieldNames
Returns the fields preset in the cache.- Returns:
- The fields preset in the cache.
-