P.java revision 2ad60cfc28e14ee8f0bb038720836a4696c478ad
1package tests.api.java.util.support; 2 3import java.util.ResourceBundle; 4 5public 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