T
- the type of the InfoProperties
to exposepublic abstract class InfoPropertiesInfoContributor<T extends InfoProperties> extends Object implements InfoContributor
InfoContributor
to expose an InfoProperties
.Modifier and Type | Class and Description |
---|---|
static class |
InfoPropertiesInfoContributor.Mode
Defines how properties should be exposed.
|
Modifier | Constructor and Description |
---|---|
protected |
InfoPropertiesInfoContributor(T properties,
InfoPropertiesInfoContributor.Mode mode) |
Modifier and Type | Method and Description |
---|---|
protected void |
copyIfSet(Properties target,
String key)
Copy the specified key to the target
Properties if it is set. |
protected Map<String,Object> |
extractContent(org.springframework.core.env.PropertySource<?> propertySource)
Extract the raw content based on the specified
PropertySource . |
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 the
value for the specified key if the value is not null . |
protected org.springframework.core.env.PropertySource<?> |
toPropertySource()
Return the
PropertySource to use based on the chosen InfoPropertiesInfoContributor.Mode . |
protected abstract org.springframework.core.env.PropertySource<?> |
toSimplePropertySource()
Return a
PropertySource for the SIMPLE mode. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contribute
protected InfoPropertiesInfoContributor(T properties, InfoPropertiesInfoContributor.Mode mode)
protected final T getProperties()
protected final InfoPropertiesInfoContributor.Mode getMode()
protected abstract org.springframework.core.env.PropertySource<?> toSimplePropertySource()
PropertySource
for the SIMPLE
mode.toPropertySource()
protected Map<String,Object> generateContent()
extractContent(PropertySource)
,
postProcessContent(Map)
protected Map<String,Object> extractContent(org.springframework.core.env.PropertySource<?> propertySource)
PropertySource
.propertySource
- the property source to useprotected void postProcessContent(Map<String,Object> content)
content
- the content to exposeprotected org.springframework.core.env.PropertySource<?> toPropertySource()
PropertySource
to use based on the chosen InfoPropertiesInfoContributor.Mode
.protected void copyIfSet(Properties target, String key)
Properties
if it is set.target
- the target properties to updatekey
- the keyprotected void replaceValue(Map<String,Object> content, String key, Object value)
value
for the specified key if the value is not null
.content
- the content to exposekey
- the property to replacevalue
- the new valueCopyright © 2020 Pivotal Software, Inc.. All rights reserved.