Package adams.env

Class AbstractPropertiesDefinition

    • Constructor Detail

      • AbstractPropertiesDefinition

        public AbstractPropertiesDefinition()
    • Method Detail

      • getKey

        public abstract String getKey()
        Returns the key this definition is for.
        Returns:
        the key
      • getFile

        public abstract String getFile()
        Returns the properties file name (no path) this definition is for.
        Returns:
        the key
      • hasAlternativeExtension

        public boolean hasAlternativeExtension()
        Returns whether an alternative extension is to be used besides the default one ("props"). Useful if distinguishing props files from different projects. Only used in "add(...) methods".
        Returns:
        true if alternative extension to be used as well
      • getAlternativeExtension

        public String getAlternativeExtension()
        Returns an alternative extension to use besides the default one ("props"). Useful if distinguishing props files from different projects. Only used in "add(...) methods".
        Returns:
        the alternative extension (without dot), null if none available
      • createPath

        public String createPath​(String dir)
        Creates a full path for the props file, from its path and filename.
        Parameters:
        dir - the directory the props file is located in
        Returns:
        the full path
        See Also:
        getFile()
      • createPath

        public String createPath​(String dir,
                                 String ext)
        Creates a full path for the props file, from its path and filename.
        Parameters:
        dir - the directory the props file is located in
        ext - the extension to replace current one, null to use default one (without the dot)
        Returns:
        the full path
        See Also:
        getFile()
      • add

        protected void add​(AbstractEnvironment env,
                           String propsdir,
                           String[] overrides)
        Adds the props file under they specified key.
        Parameters:
        env - the environment to update
        propsdir - the location of the props file (e.g., "adams/gui")
        overrides - the keys to override with the values from props files added later on
      • add

        protected void add​(AbstractEnvironment env,
                           String propsdir,
                           String home,
                           String[] overrides)
        Adds the props file under they specified key.
        Parameters:
        env - the environment to update
        propsdir - the location of the props file (e.g., "adams/gui")
        home - the home directory to use
        overrides - the keys to override with the values from props files added later on
      • add

        protected void add​(AbstractEnvironment env,
                           String propsdir,
                           List<String> dirs,
                           String[] overrides)
        Adds the props file under they specified key.
        Parameters:
        env - the environment to update
        propsdir - the location of the props file (e.g., "adams/gui")
        dirs - the directories to look for
        overrides - the keys (or regular expression of keys) to override with the values from props files added later on
      • replace

        protected void replace​(AbstractEnvironment env,
                               String propsdir)
        Adds the props file under they specified key. Previously added props files are removed first.
        Parameters:
        env - the environment to update
        propsdir - the location of the props file (e.g., "adams/gui")
      • replace

        protected void replace​(AbstractEnvironment env,
                               String propsdir,
                               List<String> dirs)
        Adds the props file under they specified key. Previously added props files are removed first.
        Parameters:
        env - the environment to update
        propsdir - the location of the props file (e.g., "adams/gui")
        dirs - the directories to look for
      • update

        public abstract void update​(AbstractEnvironment env)
        Updates the environment object with its definition for the props file (whether to add/replace/etc the values).
        Parameters:
        env - the environment object to update
      • toString

        public String toString()
        Returns a short description.
        Overrides:
        toString in class Object
        Returns:
        the short description