public static FlexibleProperties makeFlexibleProperties(URL url, Properties properties) { return new FlexibleProperties(url, properties); }
public Object clone() { FlexibleProperties c = (FlexibleProperties) super.clone(); // avoid recursion for some reason someone used themselves as defaults if (defaults != null && !this.equals(defaults)) { c.defaults = (FlexibleProperties) getDefaultProperties().clone(); } return c; }
public void interpolateProperties() { if ((defaults != null) && (defaults instanceof FlexibleProperties)) { ((FlexibleProperties) defaults).interpolateProperties(); } interpolateProperties(this, getTruncateIfMissing()); }
properties = FlexibleProperties.makeFlexibleProperties(url); urlCache.put(url, properties); } catch (MissingResourceException e) { String curName = null; while ((curName = properties.getProperty("name." + curIdx)) != null) { if (name.equals(curName)) { value = properties.getProperty("value." + curIdx); break;
protected synchronized void load() throws IOException { if (url == null) return; InputStream in = null; try { in = url.openStream(); } catch (Exception urlex) { Debug.log("[FlexibleProperties.load]: Couldn't find the URL: " + url); Debug.log(urlex); } if (in == null) throw new IOException("Could not open resource URL " + url); super.load(in); in.close(); if (defaults instanceof FlexibleProperties) ((FlexibleProperties) defaults).reload(); if (getDoPropertyExpansion()) interpolateProperties(); }
public static String interpolate(String value, Properties props) { return interpolate(value, props, truncateIfMissingDefault); }
public String toString() { StringBuffer retVal = new StringBuffer(); Set keySet = keySet(); Iterator keys = keySet.iterator(); while (keys.hasNext()) { String key = keys.next().toString(); String value = getProperty(key); retVal.append(key); retVal.append("="); retVal.append(value); retVal.append("\n"); } return retVal.toString(); } }
public FlexibleProperties(URL url, Properties properties) { super(properties); this.url = url; init(); }
public static void interpolateProperties(Properties props) { interpolateProperties(props, truncateIfMissingDefault); }
properties = FlexibleProperties.makeFlexibleProperties(url); urlCache.put(url, properties); } catch (MissingResourceException e) { String curName = null; while ((curName = properties.getProperty("name." + curIdx)) != null) { if (name.equals(curName)) { value = properties.getProperty("value." + curIdx); break;
protected synchronized void load() throws IOException { if (url == null) return; InputStream in = null; try { in = url.openStream(); } catch (Exception urlex) { Debug.log("[FlexibleProperties.load]: Couldn't find the URL: " + url); Debug.log(urlex); } if (in == null) throw new IOException("Could not open resource URL " + url); super.load(in); in.close(); if (defaults instanceof FlexibleProperties) ((FlexibleProperties) defaults).reload(); if (getDoPropertyExpansion()) interpolateProperties(); }
public static String interpolate(String value, Properties props) { return interpolate(value, props, truncateIfMissingDefault); }
public String toString() { StringBuffer retVal = new StringBuffer(); Set keySet = keySet(); Iterator keys = keySet.iterator(); while (keys.hasNext()) { String key = keys.next().toString(); String value = getProperty(key); retVal.append(key); retVal.append("="); retVal.append(value); retVal.append("\n"); } return retVal.toString(); } }
public void setURL(URL url) { this.url = url; init(); }
public static void interpolateProperties(Properties props) { interpolateProperties(props, truncateIfMissingDefault); }
/** Returns the value of the specified property name from the specified resource/properties file * @param url URL object specifying the location of the resource * @param name The name of the property in the properties file * @return The value of the property in the properties file */ public static String getPropertyValue(URL url, String name) { if (url == null) return ""; if (name == null || name.length() <= 0) return ""; FlexibleProperties properties = (FlexibleProperties) urlCache.get(url); if (properties == null) { try { properties = FlexibleProperties.makeFlexibleProperties(url); urlCache.put(url, properties); } catch (MissingResourceException e) { Debug.log(e.getMessage()); } } if (properties == null) { Debug.log("[UtilProperties.getPropertyValue] could not find resource: " + url); return null; } String value = null; try { value = properties.getProperty(name); } catch (Exception e) { Debug.log(e.getMessage()); } return value == null ? "" : value.trim(); }
public static FlexibleProperties makeFlexibleProperties(URL url) { return new FlexibleProperties(url); }
public void interpolateProperties() { if ((defaults != null) && (defaults instanceof FlexibleProperties)) { ((FlexibleProperties) defaults).interpolateProperties(); } interpolateProperties(this, getTruncateIfMissing()); }
public Object clone() { FlexibleProperties c = (FlexibleProperties) super.clone(); // avoid recursion for some reason someone used themselves as defaults if (defaults != null && !this.equals(defaults)) { c.defaults = (FlexibleProperties) getDefaultProperties().clone(); } return c; }
public static String interpolate(String value, Properties props, boolean truncateIfMissing) { return interpolate(value, props, truncateIfMissing, null); }