Home | History | Annotate | Download | only in support
      1 package tests.api.java.util.support;
      2 
      3 import java.util.ResourceBundle;
      4 
      5 public class P {
      6     private Class c;
      7 
      8     public void setClazz(Class c) {
      9         this.c = c;
     10     }
     11 
     12     public String findProp(String key) {
     13         return findProp(this.c, key);
     14     }
     15 
     16     private String findProp(Class cls, String key) {
     17         String ret = null;
     18         try {
     19             ResourceBundle b = ResourceBundle.getBundle(cls.getName());
     20             ret = (String)b.getObject(key);
     21         } catch (Exception e) {
     22         }
     23         if (ret == null && !cls.equals(Object.class) && !cls.isPrimitive()) {
     24             ret = findProp(cls.getSuperclass(), key);
     25         }
     26         return ret;
     27     }
     28 }
     29