View Javadoc
1   package net.sourceforge.rpgee.utility;
2   
3   import java.util.Properties;
4   
5   import net.sourceforge.rpgee.dice.exceptions.MissingParameterException;
6   
7   public class UtilsClass {
8   
9       private static UtilsClass instance = null;
10  
11      public final static UtilsClass getInstance() {
12          if (instance == null)
13              instance = new UtilsClass();
14          return instance;
15      }
16  
17      private UtilsClass() {
18          super();
19      }
20  
21      public String getProperty(Properties p, Object x, String key , boolean required) throws MissingParameterException {
22          String s = p.getProperty(x.getClass().getCanonicalName() + "." + key);
23          if (required && s == null)
24              throw new MissingParameterException("utils.error.missing-parameter", key);
25          return s;
26      }
27  
28  }