Package aQute.lib.env

Class Env

    • Constructor Detail

      • Env

        public Env()
      • Env

        public Env​(java.util.Properties properties,
                   Env parent,
                   java.io.File base)
      • Env

        public Env​(Env env)
    • Method Detail

      • process

        public java.lang.String process​(java.lang.String line)
        Specified by:
        process in interface Replacer
      • getMap

        public java.util.Map<java.lang.String,​java.lang.String> getMap()
        Specified by:
        getMap in interface Domain
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String deflt)
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.String value)
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.String value)
      • removeProperty

        public void removeProperty​(java.lang.String key)
      • putAll

        public void putAll​(java.util.Map<java.lang.String,​java.lang.String> map)
      • putAll

        public void putAll​(java.util.Properties map)
      • addAll

        public void addAll​(java.util.Map<java.lang.String,​java.lang.String> map)
      • addAll

        public void addAll​(java.util.Properties map)
      • setProperties

        public void setProperties​(java.io.File file)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • addProperties

        public void addProperties​(java.io.File file,
                                  java.util.regex.Pattern matching)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setProperties

        public void setProperties​(java.net.URI uri)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getHeader

        public Header getHeader​(java.lang.String header)
      • getHeader

        public Header getHeader​(java.lang.String header,
                                java.lang.String deflt)
      • getBase

        public java.io.File getBase()
      • setBase

        public void setBase​(java.io.File file)
      • getFile

        public java.io.File getFile​(java.lang.String file)
      • addTarget

        public void addTarget​(java.lang.Object domain)
      • removeTarget

        public void removeTarget​(java.lang.Object domain)
      • prepare

        protected boolean prepare()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isPrepared

        protected boolean isPrepared()
      • clear

        protected boolean clear()
      • getProperties

        protected java.util.Properties getProperties()
      • getFile

        public java.io.File getFile​(java.lang.String file,
                                    java.lang.String notfound)
        Return a file relative to the base.
      • getDir

        public java.io.File getDir​(java.lang.String file,
                                   java.lang.String notfound)
      • config

        public <T> T config​(java.lang.Class<?> front,
                            java.lang.String prefix)
        This method returns an interface that can be used to get and set the properties in a type safe way (as well as describing any semantics of these properties).

        The interface must have get and/or set methods. The name is mangled to change _ to . and to remove $ (which is used to mask keywords like new). If _ and $ are in there twice, one remains. The set methods return the proxy object itself so you can use it in a builder style.

        The values are always stored as strings (and can use macros). The result is converted to the desired type. Arguments in the set methods are always converted to strings using the toString methods.

        Example:

          interface MyConfig { int level(); MyConfig level(int level);
         Pattern pattern(); MyConfig pattern(String p); } Env env = ... MyConfig c
         = env.config(MyConfig.class, "myconfig.");
         
        Parameters:
        front - the fronting interface
        prefix - the prefix in the properties
        Returns:
        an interface that can be used to get and set properties
      • config

        public <T> T config​(java.lang.Class<?> front)
      • isTrue

        public boolean isTrue​(java.lang.String v)