Class InfoPropertiesInfoContributor<T extends org.springframework.boot.info.InfoProperties>
- java.lang.Object
- org.springframework.boot.actuate.info.InfoPropertiesInfoContributor<T>
- Type Parameters:
T
- the type of theInfoProperties
to expose
- All Implemented Interfaces:
InfoContributor
- Direct Known Subclasses:
BuildInfoContributor
,GitInfoContributor
public abstract class InfoPropertiesInfoContributor<T extends org.springframework.boot.info.InfoProperties> extends Object implements InfoContributor
A baseInfoContributor
to expose anInfoProperties
.- Since:
- 1.4.0
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InfoPropertiesInfoContributor.Mode
Defines how properties should be exposed.
Constructor Summary
Constructors Modifier Constructor Description protected
InfoPropertiesInfoContributor(T properties, InfoPropertiesInfoContributor.Mode mode)
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
copyIfSet(Properties target, String key)
Copy the specified key to the targetProperties
if it is set.protected Map<String,Object>
extractContent(org.springframework.core.env.PropertySource<?> propertySource)
Extract the raw content based on the specifiedPropertySource
.protected Map<String,Object>
generateContent()
Extract the content to contribute to the info endpoint.protected InfoPropertiesInfoContributor.Mode
getMode()
Return the mode that should be used to expose the content.protected Map<String,Object>
getNestedMap(Map<String,Object> map, String key)
Return the nested map with the specified key or empty map if the specified map contains no mapping for the key.protected T
getProperties()
Return the properties that this instance manages.protected void
postProcessContent(Map<String,Object> content)
Post-process the content to expose.protected void
replaceValue(Map<String,Object> content, String key, Object value)
Replace thevalue
for the specified key if the value is notnull
.protected org.springframework.core.env.PropertySource<?>
toPropertySource()
Return thePropertySource
to use based on the chosenInfoPropertiesInfoContributor.Mode
.protected abstract org.springframework.core.env.PropertySource<?>
toSimplePropertySource()
Return aPropertySource
for theSIMPLE
mode.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.boot.actuate.info.InfoContributor
contribute
Constructor Detail
InfoPropertiesInfoContributor
protected InfoPropertiesInfoContributor(T properties, InfoPropertiesInfoContributor.Mode mode)
Method Detail
getProperties
protected final T getProperties()
Return the properties that this instance manages.- Returns:
- the info properties
getMode
protected final InfoPropertiesInfoContributor.Mode getMode()
Return the mode that should be used to expose the content.- Returns:
- the mode
toSimplePropertySource
protected abstract org.springframework.core.env.PropertySource<?> toSimplePropertySource()
Return aPropertySource
for theSIMPLE
mode.- Returns:
- the property source for the simple model
- See Also:
toPropertySource()
generateContent
protected Map<String,Object> generateContent()
Extract the content to contribute to the info endpoint.- Returns:
- the content to expose
- See Also:
extractContent(PropertySource)
,postProcessContent(Map)
extractContent
protected Map<String,Object> extractContent(org.springframework.core.env.PropertySource<?> propertySource)
Extract the raw content based on the specifiedPropertySource
.- Parameters:
propertySource
- the property source to use- Returns:
- the raw content
postProcessContent
protected void postProcessContent(Map<String,Object> content)
Post-process the content to expose. Elements can be added, changed or removed.- Parameters:
content
- the content to expose
toPropertySource
protected org.springframework.core.env.PropertySource<?> toPropertySource()
Return thePropertySource
to use based on the chosenInfoPropertiesInfoContributor.Mode
.- Returns:
- the property source
copyIfSet
protected void copyIfSet(Properties target, String key)
Copy the specified key to the targetProperties
if it is set.- Parameters:
target
- the target properties to updatekey
- the key
replaceValue
protected void replaceValue(Map<String,Object> content, String key, Object value)
Replace thevalue
for the specified key if the value is notnull
.- Parameters:
content
- the content to exposekey
- the property to replacevalue
- the new value