Class InfoPropertiesInfoContributor<T extends 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 InfoProperties>
extends Object
implements InfoContributor
A base
InfoContributor
to expose an InfoProperties
.- Since:
- 1.4.0
- Author:
- Stephane Nicoll, Madhura Bhave
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Defines how properties should be exposed. -
Constructor Summary
ModifierConstructorDescriptionprotected
InfoPropertiesInfoContributor
(T properties, InfoPropertiesInfoContributor.Mode mode) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
copyIfSet
(Properties target, String key) Copy the specified key to the targetProperties
if it is set.extractContent
(PropertySource<?> propertySource) Extract the raw content based on the specifiedPropertySource
.Extract the content to contribute to the info endpoint.protected final InfoPropertiesInfoContributor.Mode
getMode()
Return the mode that should be used to expose the content.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 final T
Return the properties that this instance manages.protected void
postProcessContent
(Map<String, Object> content) Post-process the content to expose.protected void
Replace thevalue
for the specified key if the value is notnull
.protected PropertySource<?>
Return thePropertySource
to use based on the chosenInfoPropertiesInfoContributor.Mode
.protected abstract PropertySource<?>
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 Details
-
InfoPropertiesInfoContributor
-
-
Method Details
-
getProperties
Return the properties that this instance manages.- Returns:
- the info properties
-
getMode
Return the mode that should be used to expose the content.- Returns:
- the mode
-
toSimplePropertySource
Return aPropertySource
for theSIMPLE
mode.- Returns:
- the property source for the simple model
- See Also:
-
generateContent
Extract the content to contribute to the info endpoint.- Returns:
- the content to expose
- See Also:
-
extractContent
Extract the raw content based on the specifiedPropertySource
.- Parameters:
propertySource
- the property source to use- Returns:
- the raw content
-
postProcessContent
Post-process the content to expose. Elements can be added, changed or removed.- Parameters:
content
- the content to expose
-
toPropertySource
Return thePropertySource
to use based on the chosenInfoPropertiesInfoContributor.Mode
.- Returns:
- the property source
-
copyIfSet
Copy the specified key to the targetProperties
if it is set.- Parameters:
target
- the target properties to updatekey
- the key
-
replaceValue
Replace thevalue
for the specified key if the value is notnull
.- Parameters:
content
- the content to exposekey
- the property to replacevalue
- the new value
-
getNestedMap
Return the nested map with the specified key or empty map if the specified map contains no mapping for the key.- Parameters:
map
- the contentkey
- the key of a nested map- Returns:
- the nested map
-