Interface FieldDiscoverer<I>
-
- Type Parameters:
I
- intermediate data type
public interface FieldDiscoverer<I>
Interface that gathers metadata from classes.Any type of data object can be added this way.
- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
FieldDiscoverer.FieldCollector<I,V>
A collector for the necessary metadata for fields.static interface
FieldDiscoverer.InstanceFactory<I>
A handler that controls the deserialization process for an object.static interface
FieldDiscoverer.MutableInstanceFactory<I>
A handler for working with mutable objects in the object mapper.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <V> @Nullable FieldDiscoverer.InstanceFactory<I>
discover(AnnotatedType target, FieldDiscoverer.FieldCollector<I,V> collector)
Inspect thetarget
type for fields to be supplied to thecollector
.static FieldDiscoverer<?>
emptyConstructorObject()
Create a new discoverer for object instance fields.static FieldDiscoverer<?>
object(CheckedFunction<AnnotatedType,@Nullable Supplier<Object>,SerializationException> instanceFactory)
Create a new discoverer for object instance fields.static FieldDiscoverer<?>
record()
Create a new field discoverer that will handle record classes.
-
-
-
Method Detail
-
record
static FieldDiscoverer<?> record()
Create a new field discoverer that will handle record classes.- Returns:
- new discoverer
- Since:
- 4.0.0
-
object
static FieldDiscoverer<?> object(CheckedFunction<AnnotatedType,@Nullable Supplier<Object>,SerializationException> instanceFactory)
Create a new discoverer for object instance fields.This discoverer will process any non-static and non-transient field in the object.
- Parameters:
instanceFactory
- a factory for instance providers- Returns:
- new discoverer
- Since:
- 4.0.0
-
emptyConstructorObject
static FieldDiscoverer<?> emptyConstructorObject()
Create a new discoverer for object instance fields.Only objects with empty constructors can be created.
- Returns:
- new discoverer
- Since:
- 4.0.0
- See Also:
for more details on which fields will be discovered.
-
discover
<V> @Nullable FieldDiscoverer.InstanceFactory<I> discover(AnnotatedType target, FieldDiscoverer.FieldCollector<I,V> collector) throws SerializationException
Inspect thetarget
type for fields to be supplied to thecollector
.If the target type is handleable, a non-null value must be returned. Fields can only be collected from one source at the moment, so if the instance factory is null any discovered fields will be discarded.
- Type Parameters:
V
- object type- Parameters:
target
- type to inspectcollector
- collector for discovered fields.- Returns:
- a factory for handling the construction of object instances, or
null
iftarget
is not of a handleable type. - Throws:
SerializationException
- if any fields have invalid data- Since:
- 4.0.0
-
-