Class Props

  • All Implemented Interfaces:
    java.lang.Iterable<Props.Prop>

    public final class Props
    extends java.lang.Object
    implements java.lang.Iterable<Props.Prop>
    Management of Properties.

    This is larger in scope than the standard Properties, as it will also handle tracking the origin of each property, if it was overridden, and also allowing for ${property} expansion.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Props.Prop  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ORIGIN_SYSPROP  
    • Constructor Summary

      Constructors 
      Constructor Description
      Props()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAll​(Props other)  
      boolean addPossibleProperty​(java.lang.String arg, java.lang.String source)
      Add a potential argument as a property.
      java.lang.String cleanReference​(java.lang.String property)  
      boolean containsKey​(java.lang.String key)  
      java.lang.String expand​(java.lang.String str)  
      Props.Prop getProp​(java.lang.String key)  
      Props.Prop getProp​(java.lang.String key, boolean searchSystemProps)  
      java.lang.String getString​(java.lang.String key)  
      java.lang.String getString​(java.lang.String key, java.lang.String defVal)  
      static java.lang.String getValue​(java.lang.String arg)  
      static java.util.List<java.lang.String> getValues​(java.lang.String arg)  
      static boolean hasPropertyKey​(java.lang.String name)  
      java.util.Iterator<Props.Prop> iterator()  
      static Props load​(java.lang.ClassLoader classLoader, java.lang.String resourceName)  
      static Props load​(java.net.URL url)  
      void reset()  
      void setProperty​(java.lang.String key, java.lang.String value, java.lang.String origin)  
      void setProperty​(Props.Prop prop)  
      void setSystemProperty​(java.lang.String key, java.lang.String value)  
      int size()  
      void store​(java.io.OutputStream stream, java.lang.String comments)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • Props

        public Props()
    • Method Detail

      • getValue

        public static java.lang.String getValue​(java.lang.String arg)
      • getValues

        public static java.util.List<java.lang.String> getValues​(java.lang.String arg)
      • addAll

        public void addAll​(Props other)
      • addPossibleProperty

        public boolean addPossibleProperty​(java.lang.String arg,
                                           java.lang.String source)
        Add a potential argument as a property.

        If arg is not a property, ignore it.

        Parameters:
        arg - the argument to parse for a potential property
        source - the source for this argument (to track origin of property from)
        Returns:
        true if the property was added, false if the property wasn't added
      • cleanReference

        public java.lang.String cleanReference​(java.lang.String property)
      • containsKey

        public boolean containsKey​(java.lang.String key)
      • expand

        public java.lang.String expand​(java.lang.String str)
      • getProp

        public Props.Prop getProp​(java.lang.String key)
      • getProp

        public Props.Prop getProp​(java.lang.String key,
                                  boolean searchSystemProps)
      • getString

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

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.String defVal)
      • hasPropertyKey

        public static boolean hasPropertyKey​(java.lang.String name)
      • iterator

        public java.util.Iterator<Props.Prop> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Props.Prop>
      • reset

        public void reset()
      • setProperty

        public void setProperty​(Props.Prop prop)
      • setProperty

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

        public int size()
      • store

        public void store​(java.io.OutputStream stream,
                          java.lang.String comments)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • setSystemProperty

        public void setSystemProperty​(java.lang.String key,
                                      java.lang.String value)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • load

        public static Props load​(java.lang.ClassLoader classLoader,
                                 java.lang.String resourceName)
      • load

        public static Props load​(java.net.URL url)