类 Binder
java.lang.Object
cn.taketoday.context.properties.bind.Binder
A container object which Binds objects from one or more
ConfigurationPropertySources.- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Harry Yang, Madhura Bhave
-
构造器概要
构造器构造器说明Binder(ConfigurationPropertySource... sources) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, cn.taketoday.core.conversion.ConversionService conversionService) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, cn.taketoday.core.conversion.ConversionService conversionService, Consumer<PropertyEditorRegistry> propertyEditorInitializer) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, cn.taketoday.core.conversion.ConversionService conversionService, Consumer<PropertyEditorRegistry> propertyEditorInitializer, BindHandler defaultBindHandler) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, cn.taketoday.core.conversion.ConversionService conversionService, Consumer<PropertyEditorRegistry> propertyEditorInitializer, BindHandler defaultBindHandler, BindConstructorProvider constructorProvider) Create a newBinderinstance for the specified sources.Binder(Iterable<ConfigurationPropertySource> sources, PlaceholdersResolver placeholdersResolver, List<cn.taketoday.core.conversion.ConversionService> conversionServices, Consumer<PropertyEditorRegistry> propertyEditorInitializer, BindHandler defaultBindHandler, BindConstructorProvider constructorProvider) Create a newBinderinstance for the specified sources. -
方法概要
修饰符和类型方法说明<T> BindResult<T>bind(ConfigurationPropertyName name, Bindable<T> target) Bind the specified targetBindableusing this binder'sproperty sources.<T> BindResult<T>bind(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sources.<T> BindResult<T>Bind the specified targetBindableusing this binder'sproperty sources.<T> BindResult<T>bind(String name, Bindable<T> target, BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sources.<T> BindResult<T>Bind the specified targetClassusing this binder'sproperty sources.<T> TbindOrCreate(ConfigurationPropertyName name, Bindable<T> target, BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.<T> TbindOrCreate(String name, Bindable<T> target) Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.<T> TbindOrCreate(String name, Bindable<T> target, BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.<T> TbindOrCreate(String name, Class<T> target) Bind the specified targetClassusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.static Binderget(cn.taketoday.core.env.Environment environment) Create a newBinderinstance from the specified environment.static Binderget(cn.taketoday.core.env.Environment environment, BindHandler defaultBindHandler) Create a newBinderinstance from the specified environment.
-
构造器详细资料
-
Binder
Create a newBinderinstance for the specified sources. ADefaultFormattingConversionServicewill be used for all conversion.- 参数:
sources- the sources used for binding
-
Binder
Create a newBinderinstance for the specified sources. ADefaultFormattingConversionServicewill be used for all conversion.- 参数:
sources- the sources used for binding
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholders
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver, @Nullable cn.taketoday.core.conversion.ConversionService conversionService) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholdersconversionService- the conversion service to convert values (ornullto useApplicationConversionService)
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver, @Nullable cn.taketoday.core.conversion.ConversionService conversionService, @Nullable Consumer<PropertyEditorRegistry> propertyEditorInitializer) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholdersconversionService- the conversion service to convert values (ornullto useApplicationConversionService)propertyEditorInitializer- initializer used to configure the property editors that can convert values (ornullif no initialization is required). Often used to callConfigurableBeanFactory.copyRegisteredEditorsTo(cn.taketoday.beans.PropertyEditorRegistry).
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver, @Nullable cn.taketoday.core.conversion.ConversionService conversionService, @Nullable Consumer<PropertyEditorRegistry> propertyEditorInitializer, @Nullable BindHandler defaultBindHandler) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholdersconversionService- the conversion service to convert values (ornullto useApplicationConversionService)propertyEditorInitializer- initializer used to configure the property editors that can convert values (ornullif no initialization is required). Often used to callConfigurableBeanFactory.copyRegisteredEditorsTo(cn.taketoday.beans.PropertyEditorRegistry).defaultBindHandler- the default bind handler to use if none is specified when binding
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver, @Nullable cn.taketoday.core.conversion.ConversionService conversionService, @Nullable Consumer<PropertyEditorRegistry> propertyEditorInitializer, @Nullable BindHandler defaultBindHandler, @Nullable BindConstructorProvider constructorProvider) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholdersconversionService- the conversion service to convert values (ornullto useApplicationConversionService)propertyEditorInitializer- initializer used to configure the property editors that can convert values (ornullif no initialization is required). Often used to callConfigurableBeanFactory.copyRegisteredEditorsTo(cn.taketoday.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 binding
-
Binder
public Binder(Iterable<ConfigurationPropertySource> sources, @Nullable PlaceholdersResolver placeholdersResolver, @Nullable List<cn.taketoday.core.conversion.ConversionService> conversionServices, @Nullable Consumer<PropertyEditorRegistry> propertyEditorInitializer, @Nullable BindHandler defaultBindHandler, @Nullable BindConstructorProvider constructorProvider) Create a newBinderinstance for the specified sources.- 参数:
sources- the sources used for bindingplaceholdersResolver- strategy to resolve any property placeholdersconversionServices- the conversion services to convert values (ornullto useApplicationConversionService)propertyEditorInitializer- initializer used to configure the property editors that can convert values (ornullif no initialization is required). Often used to callConfigurableBeanFactory.copyRegisteredEditorsTo(cn.taketoday.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 binding
-
-
方法详细资料
-
bind
Bind the specified targetClassusing this binder'sproperty sources.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target class- 返回:
- the binding result (never
null) - 另请参阅:
-
bind
Bind the specified targetBindableusing this binder'sproperty sources.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindable- 返回:
- the binding result (never
null) - 另请参阅:
-
bind
Bind the specified targetBindableusing this binder'sproperty sources.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindable- 返回:
- the binding result (never
null) - 另请参阅:
-
bind
Bind the specified targetBindableusing this binder'sproperty sources.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindablehandler- the bind handler (may benull)- 返回:
- the binding result (never
null)
-
bind
public <T> BindResult<T> bind(ConfigurationPropertyName name, Bindable<T> target, @Nullable BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sources.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindablehandler- the bind handler (may benull)- 返回:
- the binding result (never
null)
-
bindOrCreate
Bind the specified targetClassusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target class- 返回:
- the bound or created object
- 另请参阅:
-
bindOrCreate
Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindable- 返回:
- the bound or created object
- 另请参阅:
-
bindOrCreate
Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.- 类型参数:
T- the bound type- 参数:
name- the configuration property name to bindtarget- the target bindablehandler- the bind handler- 返回:
- the bound or created object
- 另请参阅:
-
bindOrCreate
public <T> T bindOrCreate(ConfigurationPropertyName name, Bindable<T> target, @Nullable BindHandler handler) Bind the specified targetBindableusing this binder'sproperty sourcesor create a new instance using the type of theBindableif the result of the binding isnull.- 类型参数:
T- the bound or created type- 参数:
name- the configuration property name to bindtarget- the target bindablehandler- the bind handler (may benull)- 返回:
- the bound or created object
-
get
Create a newBinderinstance from the specified environment.- 参数:
environment- the environment source (must have attachedConfigurationPropertySources)- 返回:
- a
Binderinstance
-
get
public static Binder get(cn.taketoday.core.env.Environment environment, @Nullable BindHandler defaultBindHandler) Create a newBinderinstance from the specified environment.- 参数:
environment- the environment source (must have attachedConfigurationPropertySources)defaultBindHandler- the default bind handler to use if none is specified when binding- 返回:
- a
Binderinstance
-