Interface ObjectFactory.ObjectFactoryInstance
- Enclosing interface:
- ObjectFactory
public static interface ObjectFactory.ObjectFactoryInstance
-
Method Summary
Modifier and TypeMethodDescription<T> T
If called the unsupported properties will be ignored otherwisecreate(Class)
will fail with an exception.Set that the properties can be injected into fields directly, default uses fields but not private ones.Set that the properties can NOT be injected into fields directly.withProperties
(Map<String, ?> properties) default <T> ObjectFactory.ObjectFactoryInstance
withProperties
(Stream<T> stream, Function<T, String> keyExtractor, Function<T, ?> valueExtractor) Shortcut forwithProperties(Map)
.
-
Method Details
-
withFieldInjection
Set that the properties can be injected into fields directly, default uses fields but not private ones.- Returns:
- this.
-
withoutFieldInjection
Set that the properties can NOT be injected into fields directly.- Returns:
- this.
-
ignoreUnknownProperties
If called the unsupported properties will be ignored otherwisecreate(Class)
will fail with an exception.- Returns:
- this.
-
withProperties
- Parameters:
properties
- the properties to use to configure the instance.- Returns:
- this.
-
withProperties
default <T> ObjectFactory.ObjectFactoryInstance withProperties(Stream<T> stream, Function<T, String> keyExtractor, Function<T, ?> valueExtractor) Shortcut forwithProperties(Map)
. Note that if there are conflicting keys the last one is used.- Type Parameters:
T
- the type of the created object.- Parameters:
stream
- a stream of properties.keyExtractor
- how to extract the key from the incoming stream.valueExtractor
- how to extract the value from the incoming stream.- Returns:
- this.
-
create
- Type Parameters:
T
- the expected type of the returned instance.- Parameters:
parentType
- the type to cast the instance to.- Returns:
- the created instance.
-