View Javadoc

1   package cz.cuni.amis.utils.configuration;
2   
3   /**
4    * Property provider is responsible for one type of property storage.
5    * Eg. some specific file.
6    * @author ik
7    */
8   public abstract class PropertyProvider implements Comparable<PropertyProvider> {
9   
10      /**
11       * Priority of this provider. It will be asked for property value before all
12       * providers with lower priority.
13       * @return
14       */
15      abstract public int getPriority();
16  
17      /**
18       * Searches for given property key.
19       * @param key
20       * @return null if the property wasn't found
21       */
22      abstract public String getProperty(String key);
23  
24      @Override
25      public int compareTo(PropertyProvider o) {
26          return o.getPriority() - getPriority();
27      }
28  }