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. |
Binder(Iterable<ConfigurationPropertySource> sources,
PlaceholdersResolver placeholdersResolver,
org.springframework.core.convert.ConversionService conversionService,
Consumer<org.springframework.beans.PropertyEditorRegistry> propertyEditorInitializer,
BindHandler defaultBindHandler)
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,
BindHandler defaultBindHandler,
BindConstructorProvider constructorProvider)
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 . |
<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 . |
<T> T |
bindOrCreate(ConfigurationPropertyName name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binder's
property sources or create a new instance using
the type of the Bindable if the result of the binding is null . |
<T> T |
bindOrCreate(String name,
Bindable<T> target)
Bind the specified target
Bindable using this binder's
property sources or create a new instance using
the type of the Bindable if the result of the binding is null . |
<T> T |
bindOrCreate(String name,
Bindable<T> target,
BindHandler handler)
Bind the specified target
Bindable using this binder's
property sources or create a new instance using
the type of the Bindable if the result of the binding is null . |
<T> T |
bindOrCreate(String name,
Class<T> target)
Bind the specified target
Class using this binder's
property sources or create a new instance using
the type of the Bindable if the result of the binding is null . |
static Binder |
get(org.springframework.core.env.Environment environment)
Create a new
Binder instance from the specified environment. |
static Binder |
get(org.springframework.core.env.Environment environment,
BindHandler defaultBindHandler)
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 Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, org.springframework.core.convert.ConversionService conversionService, Consumer<org.springframework.beans.PropertyEditorRegistry> propertyEditorInitializer, BindHandler defaultBindHandler)
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)
.defaultBindHandler
- the default bind handler to use if none is specified when
bindingpublic Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, org.springframework.core.convert.ConversionService conversionService, Consumer<org.springframework.beans.PropertyEditorRegistry> propertyEditorInitializer, BindHandler defaultBindHandler, BindConstructorProvider constructorProvider)
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)
.defaultBindHandler
- the default bind handler to use if none is specified when
bindingconstructorProvider
- the constructor provider which provides the bind
constructor to use when bindingpublic <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
)public <T> T bindOrCreate(String name, Class<T> target)
Class
using this binder's
property sources
or create a new instance using
the type of the Bindable
if the result of the binding is null
.T
- the bound typename
- the configuration property name to bindtarget
- the target classbind(ConfigurationPropertyName, Bindable, BindHandler)
public <T> T bindOrCreate(String name, Bindable<T> target)
Bindable
using this binder's
property sources
or create a new instance using
the type of the Bindable
if the result of the binding is null
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablebindOrCreate(ConfigurationPropertyName, Bindable, BindHandler)
public <T> T bindOrCreate(String name, Bindable<T> target, BindHandler handler)
Bindable
using this binder's
property sources
or create a new instance using
the type of the Bindable
if the result of the binding is null
.T
- the bound typename
- the configuration property name to bindtarget
- the target bindablehandler
- the bind handlerbindOrCreate(ConfigurationPropertyName, Bindable, BindHandler)
public <T> T bindOrCreate(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler)
Bindable
using this binder's
property sources
or create a new instance using
the type of the Bindable
if the result of the binding is null
.T
- the bound or created typename
- the configuration property name to bindtarget
- the target bindablehandler
- the bind handler (may be null
)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
instancepublic static Binder get(org.springframework.core.env.Environment environment, BindHandler defaultBindHandler)
Binder
instance from the specified environment.environment
- the environment source (must have attached
ConfigurationPropertySources
)defaultBindHandler
- the default bind handler to use if none is specified when
bindingBinder
instanceCopyright © 2019 Pivotal Software, Inc.. All rights reserved.