Package adams.env

Class Setup

    • Field Detail

      • m_PropertiesFile

        protected String m_PropertiesFile
        the props file.
      • m_Directories

        protected List<String> m_Directories
        the directories to look for.
      • m_Overrides

        protected List<String> m_Overrides
        keys (or regular expression of keys) that only the last props file is allowed to have.
    • Constructor Detail

      • Setup

        public Setup​(String props,
                     List<String> dirs)
        Initializes the container.
        Parameters:
        props - the properties file
        dirs - the directories to search
      • Setup

        public Setup​(String props,
                     List<String> dirs,
                     String[] overrides)
        Initializes the container.
        Parameters:
        props - the properties file
        dirs - the directories to search
        overrides - the keys (or regular expression of leys) to override with the last props file
    • Method Detail

      • getPropertiesFile

        public String getPropertiesFile()
        Returns the properties file stored (incl path).
        Returns:
        the props file
      • getFilename

        public String getFilename()
        Returns the filename of the properties file without the path.
        Returns:
        the filename
      • getDirectories

        public List<String> getDirectories()
        Returns the directories to search.
        Returns:
        the directories
      • hasOverrides

        public boolean hasOverrides()
        Checks whether any overrides for keys are defined.
        Returns:
        true if overrides available
      • getOverrides

        public List<String> getOverrides()
        Returns the override keys (or regular expressions).
        Returns:
        the keys (or regular expressions)
      • mergeWith

        public void mergeWith​(Setup other)
        Merges its own data with the one provided by the specified setup. But only if the filenames (without the path) are the same.
        Specified by:
        mergeWith in interface Mergeable<Setup>
        Parameters:
        other - the setup to merge with
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface Comparable
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Hashcode so can be used as hashtable key. Returns the hashcode of the props file string.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • toString

        public String toString()
        Returns a string representation of the container.
        Overrides:
        toString in class Object
        Returns:
        the representation