类 ConfigurationPropertyName
- java.lang.Object
- org.springframework.boot.context.properties.source.ConfigurationPropertyName
- 所有已实现的接口:
Comparable<ConfigurationPropertyName>
public final class ConfigurationPropertyName extends Object implements Comparable<ConfigurationPropertyName>
A configuration property name composed of elements separated by dots. User created names may contain the characters "a-z
" "0-9
") and "-
", they must be lower-case and must start with an alpha-numeric character. The "-
" is used purely for formatting, i.e. "foo-bar
" and "foobar
" are considered equivalent.The "
[
" and "]
" characters may be used to indicate an associative index(i.e. aMap
key or aCollection
index. Indexes names are not restricted and are considered case-sensitive.Here are some typical examples:
spring.main.banner-mode
server.hosts[0].name
log[org.springboot].level
- 从以下版本开始:
- 2.0.0
- 另请参阅:
of(CharSequence)
,ConfigurationPropertySource
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
ConfigurationPropertyName.Form
The various forms that a non-indexed element value can take.
字段概要
字段 修饰符和类型 字段 说明 static ConfigurationPropertyName
EMPTY
An emptyConfigurationPropertyName
.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 ConfigurationPropertyName
append(String elementValue)
Create a newConfigurationPropertyName
by appending the given element value.ConfigurationPropertyName
chop(int size)
Return a newConfigurationPropertyName
by chopping this name to the givensize
.int
compareTo(ConfigurationPropertyName other)
boolean
equals(Object obj)
String
getElement(int elementIndex, ConfigurationPropertyName.Form form)
Return an element in the name in the given form.String
getLastElement(ConfigurationPropertyName.Form form)
Return the last element in the name in the given form.int
getNumberOfElements()
Return the total number of elements in the name.int
hashCode()
boolean
isAncestorOf(ConfigurationPropertyName name)
Returnstrue
if this element is an ancestor (immediate or nested parent) of the specified name.boolean
isEmpty()
Returnstrue
if thisConfigurationPropertyName
is empty.boolean
isLastElementIndexed()
Return if the last element in the name is indexed.boolean
isNumericIndex(int elementIndex)
Return if the element in the name is indexed and numeric.boolean
isParentOf(ConfigurationPropertyName name)
Returnstrue
if this element is an immediate parent of the specified name.static boolean
isValid(CharSequence name)
Returns if the given name is valid.static ConfigurationPropertyName
of(CharSequence name)
Return aConfigurationPropertyName
for the specified string.String
toString()
字段详细资料
EMPTY
public static final ConfigurationPropertyName EMPTY
An emptyConfigurationPropertyName
.
方法详细资料
isEmpty
public boolean isEmpty()
Returnstrue
if thisConfigurationPropertyName
is empty.- 返回:
true
if the name is empty
isLastElementIndexed
public boolean isLastElementIndexed()
Return if the last element in the name is indexed.- 返回:
true
if the last element is indexed
isNumericIndex
public boolean isNumericIndex(int elementIndex)
Return if the element in the name is indexed and numeric.- 参数:
elementIndex
- the index of the element- 返回:
true
if the element is indexed and numeric
getLastElement
public String getLastElement(ConfigurationPropertyName.Form form)
Return the last element in the name in the given form.- 参数:
form
- the form to return- 返回:
- the last element
getElement
public String getElement(int elementIndex, ConfigurationPropertyName.Form form)
Return an element in the name in the given form.- 参数:
elementIndex
- the element indexform
- the form to return- 返回:
- the last element
getNumberOfElements
public int getNumberOfElements()
Return the total number of elements in the name.- 返回:
- the number of elements
append
public ConfigurationPropertyName append(String elementValue)
Create a newConfigurationPropertyName
by appending the given element value.- 参数:
elementValue
- the single element value to append- 返回:
- a new
ConfigurationPropertyName
- 抛出:
InvalidConfigurationPropertyNameException
- if elementValue is not valid
chop
public ConfigurationPropertyName chop(int size)
Return a newConfigurationPropertyName
by chopping this name to the givensize
. For example,chop(1)
on the namefoo.bar
will returnfoo
.- 参数:
size
- the size to chop- 返回:
- the chopped name
isParentOf
public boolean isParentOf(ConfigurationPropertyName name)
Returnstrue
if this element is an immediate parent of the specified name.- 参数:
name
- the name to check- 返回:
true
if this name is an ancestor
isAncestorOf
public boolean isAncestorOf(ConfigurationPropertyName name)
Returnstrue
if this element is an ancestor (immediate or nested parent) of the specified name.- 参数:
name
- the name to check- 返回:
true
if this name is an ancestor
compareTo
public int compareTo(ConfigurationPropertyName other)
- 指定者:
compareTo
在接口中Comparable<ConfigurationPropertyName>
isValid
public static boolean isValid(CharSequence name)
Returns if the given name is valid. If this method returnstrue
then the name may be used withof(CharSequence)
without throwing an exception.- 参数:
name
- the name to test- 返回:
true
if the name is valid
of
public static ConfigurationPropertyName of(CharSequence name)
Return aConfigurationPropertyName
for the specified string.- 参数:
name
- the source name- 返回:
- a
ConfigurationPropertyName
instance - 抛出:
InvalidConfigurationPropertyNameException
- if the name is not valid