Class Environment


  • public class Environment
    extends Object
    Simple plain text serializable encapsulation of a list of property sources. Basically a DTO for Environment, but also applicable outside the domain of a Spring application.
    Author:
    Dave Syer, Spencer Gibb
    • 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​(String name,
                           String... profiles)
      • 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 (_).
      • 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)