/** * Constructs a new Descriptor based on the specified properties. * @param props the Properties */ public Descriptor(Properties props) { addProperties(props); }
/** * Constructs a new Descriptor based on the specified properties. * @param props the Properties */ public Descriptor(Properties props) { addProperties(props); }
/** * Adds discovered default properties using the specified classloader. * @param loader the classloader to use to look up the default properties */ public void addDefaultProperties(ClassLoader loader) { Properties props = new Properties(); PropertiesPuller props_puller = new PropertiesPuller(); try { List<URL> urls = Classes.getResources(DEFAULT_PROPERTIES, loader); for (URL url : urls) { Properties url_props = props_puller.pull(url); Enumeration<?> pn_enum = url_props.propertyNames(); while (pn_enum.hasMoreElements()) { String pn = (String)pn_enum.nextElement(); props.setProperty(pn, url_props.getProperty(pn)); } } } catch (IOException ioe) { // should never happen throw new RuntimeException(ioe); } addProperties(props); }
/** * Adds discovered default properties using the specified classloader. * @param loader the classloader to use to look up the default properties */ public void addDefaultProperties(ClassLoader loader) { Properties props = new Properties(); PropertiesPuller props_puller = new PropertiesPuller(); try { List<URL> urls = Classes.getResources(DEFAULT_PROPERTIES, loader); for (URL url : urls) { Properties url_props = props_puller.pull(url); Enumeration<?> pn_enum = url_props.propertyNames(); while (pn_enum.hasMoreElements()) { String pn = (String)pn_enum.nextElement(); props.setProperty(pn, url_props.getProperty(pn)); } } } catch (IOException ioe) { // should never happen throw new RuntimeException(ioe); } addProperties(props); }