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,
ConversionService conversionService)
Create a new
Binder instance for the specified sources. |
Binder(Iterable<ConfigurationPropertySource> sources,
PlaceholdersResolver placeholdersResolver,
ConversionService conversionService,
Consumer<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 binders
property sources . |
<T> BindResult<T> |
bind(ConfigurationPropertyName name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binders
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 binders
property sources . |
<T> BindResult<T> |
bind(String name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binders
property sources . |
<T> BindResult<T> |
bind(String name,
Class<T> target)
Bind the specified target
Class using this binders
property sources . |
static Binder |
get(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 place-holderspublic Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, ConversionService conversionService)
Binder
instance for the specified sources.sources
- the sources used for bindingplaceholdersResolver
- strategy to resolve any property place-holdersconversionService
- the conversion service to convert values (or null
to use ApplicationConversionService
)public Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, ConversionService conversionService, Consumer<PropertyEditorRegistry> propertyEditorInitializer)
Binder
instance for the specified sources.sources
- the sources used for bindingplaceholdersResolver
- strategy to resolve any property place-holdersconversionService
- 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 binders
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 binders
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 binders
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 binders
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 binders
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(Environment environment)
Binder
instance from the specified environment.environment
- the environment source (must have attached
ConfigurationPropertySources
)Binder
instanceCopyright © 2018 Pivotal Software, Inc.. All rights reserved.