public class Binder extends Object
ConfigurationPropertySources
.Constructor and Description |
---|
Binder(ConfigurationPropertySource... sources)
Create a new
Binder instance for the specified sources. |
Binder(Iterable<ConfigurationPropertySource> sources)
Create a new
Binder instance for the specified sources. |
Binder(Iterable<ConfigurationPropertySource> sources,
PlaceholdersResolver placeholdersResolver)
Create a new
Binder instance for the specified sources. |
Binder(Iterable<ConfigurationPropertySource> sources,
PlaceholdersResolver placeholdersResolver,
org.springframework.core.convert.ConversionService conversionService)
Create a new
Binder instance for the specified sources. |
Binder(Iterable<ConfigurationPropertySource> sources,
PlaceholdersResolver placeholdersResolver,
org.springframework.core.convert.ConversionService conversionService,
Consumer<org.springframework.beans.PropertyEditorRegistry> propertyEditorInitializer)
Create a new
Binder instance for the specified sources. |
Modifier and Type | Method and Description |
---|---|
<T> BindResult<T> |
bind(ConfigurationPropertyName name,
Bindable<T> target)
Bind the specified target
Bindable using this binder's
property sources . |
<T> BindResult<T> |
bind(ConfigurationPropertyName name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binder's
property sources . |
protected <T> T |
bind(ConfigurationPropertyName name,
Bindable<T> target,
BindHandler handler,
org.springframework.boot.context.properties.bind.Binder.Context context,
boolean allowRecursiveBinding) |
<T> BindResult<T> |
bind(String name,
Bindable<T> target)
Bind the specified target
Bindable using this binder's
property sources . |
<T> BindResult<T> |
bind(String name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binder's
property sources . |
<T> BindResult<T> |
bind(String name,
Class<T> target)
Bind the specified target
Class using this binder's
property sources . |
static Binder |
get(org.springframework.core.env.Environment environment)
Create a new
Binder instance from the specified environment. |
public Binder(ConfigurationPropertySource... sources)
Binder
instance for the specified sources. A
DefaultFormattingConversionService
will be used for all conversion.sources
- the sources used for bindingpublic Binder(Iterable<ConfigurationPropertySource> sources)
Binder
instance for the specified sources. A
DefaultFormattingConversionService
will be used for all conversion.sources
- the sources used for bindingpublic Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver)
Binder
instance for the specified sources.sources
- the sources used for bindingplaceholdersResolver
- strategy to resolve any property placeholderspublic Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, org.springframework.core.convert.ConversionService conversionService)
Binder
instance for the specified sources.sources
- the sources used for bindingplaceholdersResolver
- strategy to resolve any property placeholdersconversionService
- the conversion service to convert values (or null
to use ApplicationConversionService
)public Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, org.springframework.core.convert.ConversionService conversionService, Consumer<org.springframework.beans.PropertyEditorRegistry> propertyEditorInitializer)
Binder
instance for the specified sources.sources
- the sources used for bindingplaceholdersResolver
- strategy to resolve any property placeholdersconversionService
- the conversion service to convert values (or null
to use ApplicationConversionService
)propertyEditorInitializer
- initializer used to configure the property editors
that can convert values (or null
if no initialization is required). Often
used to call ConfigurableBeanFactory.copyRegisteredEditorsTo(org.springframework.beans.PropertyEditorRegistry)
.public <T> BindResult<T> bind(String name, Class<T> target)
Class
using this binder's
property sources
.T
- the bound typename
- the configuration property name to bindtarget
- the target classnull
)bind(ConfigurationPropertyName, Bindable, BindHandler)
public <T> BindResult<T> bind(String name, Bindable<T> target)
Bindable
using this binder's
property sources
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablenull
)bind(ConfigurationPropertyName, Bindable, BindHandler)
public <T> BindResult<T> bind(ConfigurationPropertyName name, Bindable<T> target)
Bindable
using this binder's
property sources
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablenull
)bind(ConfigurationPropertyName, Bindable, BindHandler)
public <T> BindResult<T> bind(String name, Bindable<T> target, BindHandler handler)
Bindable
using this binder's
property sources
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablehandler
- the bind handler (may be null
)null
)public <T> BindResult<T> bind(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler)
Bindable
using this binder's
property sources
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablehandler
- the bind handler (may be null
)null
)protected final <T> T bind(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler, org.springframework.boot.context.properties.bind.Binder.Context context, boolean allowRecursiveBinding)
public static Binder get(org.springframework.core.env.Environment environment)
Binder
instance from the specified environment.environment
- the environment source (must have attached
ConfigurationPropertySources
)Binder
instanceCopyright © 2020 Pivotal Software, Inc.. All rights reserved.