/** 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(); }
/** 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(); }
properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(resource, properties); } catch (MissingResourceException e) {
properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(resource, properties); } catch (MissingResourceException e) {
properties = FlexibleProperties.makeFlexibleProperties(url); urlCache.put(url, properties); } catch (MissingResourceException e) {
properties = FlexibleProperties.makeFlexibleProperties(url); urlCache.put(url, properties); } catch (MissingResourceException e) {
properties = getProperties(resource); } else { properties = FlexibleProperties.makeFlexibleProperties(url);
/** Returns the specified resource/properties file * @param resource The name of the resource - can be a file, class, or URL * @return The properties file */ public static Properties getProperties(String resource) { if (resource == null || resource.length() <= 0) return null; Properties properties = (FlexibleProperties) resourceCache.get(resource); if (properties == null) { try { URL url = UtilURL.fromResource(resource); if (url == null) return null; properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(resource, properties); } catch (MissingResourceException e) { Debug.log(e.getMessage()); } } if (properties == null) { Debug.log("[UtilProperties.getProperties] could not find resource: " + resource); return null; } return properties; }
/** Returns the specified resource/properties file * @param resource The name of the resource - can be a file, class, or URL * @return The properties file */ public static Properties getProperties(String resource) { if (resource == null || resource.length() <= 0) return null; Properties properties = (FlexibleProperties) resourceCache.get(resource); if (properties == null) { try { URL url = UtilURL.fromResource(resource); if (url == null) return null; properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(resource, properties); } catch (MissingResourceException e) { Debug.log(e.getMessage()); } } if (properties == null) { Debug.log("[UtilProperties.getProperties] could not find resource: " + resource); return null; } return properties; }
properties = getProperties(resource); } else { properties = FlexibleProperties.makeFlexibleProperties(url);
/** Returns the specified resource/properties file * @param resource The name of the resource - can be a file, class, or URL * @return The properties file */ public static Properties getProperties(URL url) { if (url == null) return null; Properties properties = (FlexibleProperties) resourceCache.get(url); if (properties == null) { try { properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(url, properties); } catch (MissingResourceException e) { Debug.log(e.getMessage()); } } if (properties == null) { Debug.log("[UtilProperties.getProperties] could not find resource: " + url); return null; } return properties; }
/** Returns the specified resource/properties file * @param resource The name of the resource - can be a file, class, or URL * @return The properties file */ public static Properties getProperties(URL url) { if (url == null) return null; Properties properties = (FlexibleProperties) resourceCache.get(url); if (properties == null) { try { properties = FlexibleProperties.makeFlexibleProperties(url); resourceCache.put(url, properties); } catch (MissingResourceException e) { Debug.log(e.getMessage()); } } if (properties == null) { Debug.log("[UtilProperties.getProperties] could not find resource: " + url); return null; } return properties; }