Class Environment
- java.lang.Object
-
- org.springframework.cloud.config.environment.Environment
-
public class Environment extends Object
Simple plain text serializable encapsulation of a list of property sources. Basically a DTO forEnvironment, but also applicable outside the domain of a Spring application.- Author:
- Dave Syer, Spencer Gibb
-
-
Field Summary
Fields Modifier and Type Field Description static StringSLASH_PLACEHOLDER"(_)" is uncommon in a git repo name, but "/" cannot be matched by Spring MVC.
-
Constructor Summary
Constructors Constructor Description Environment(String name, String... profiles)Environment(String name, String[] profiles, String label, String version, String state)Environment(Environment env)Copies all fields except propertySources.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(PropertySource propertySource)voidaddAll(List<PropertySource> propertySources)voidaddFirst(PropertySource propertySource)static Stringdenormalize(String s)Utility method for denormalizing names and labels.StringgetLabel()StringgetName()String[]getProfiles()List<PropertySource>getPropertySources()StringgetState()StringgetVersion()static Stringnormalize(String s)Utility method for normalizing names and labels.voidsetLabel(String label)voidsetName(String name)voidsetProfiles(String[] profiles)voidsetState(String state)voidsetVersion(String version)StringtoString()
-
-
-
Field Detail
-
SLASH_PLACEHOLDER
public static final String SLASH_PLACEHOLDER
"(_)" is uncommon in a git repo name, but "/" cannot be matched by Spring MVC.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Environment
public Environment(Environment env)
Copies all fields except propertySources.- Parameters:
env- Spring Environment
-
-
Method Detail
-
normalize
public static String normalize(String s)
Utility method for normalizing names and labels.- Parameters:
s- String to normalize.- Returns:
- if s contains (_), replace with slash.
-
denormalize
public static String denormalize(String s)
Utility method for denormalizing names and labels.- Parameters:
s- String to denormalize.- Returns:
- if s contains slash, replace with (_).
-
add
public void add(PropertySource propertySource)
-
addAll
public void addAll(List<PropertySource> propertySources)
-
addFirst
public void addFirst(PropertySource propertySource)
-
getPropertySources
public List<PropertySource> getPropertySources()
-
getName
public String getName()
-
setName
public void setName(String name)
-
getLabel
public String getLabel()
-
setLabel
public void setLabel(String label)
-
getProfiles
public String[] getProfiles()
-
setProfiles
public void setProfiles(String[] profiles)
-
getVersion
public String getVersion()
-
setVersion
public void setVersion(String version)
-
getState
public String getState()
-
setState
public void setState(String state)
-
-