|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bbn.openmap.util.PropUtils
Field Summary | |
static java.lang.String |
keyValueSeparators
Borrowed from Properites.java |
static java.lang.String |
propertySeparators
As defined in the OGC Web Mapping Testbed. |
static java.lang.String |
strictKeyValueSeparators
Borrowed from Properites.java |
static java.lang.String |
whiteSpaceChars
Borrowed from Properites.java |
Constructor Summary | |
PropUtils()
|
Method Summary | |
static boolean |
booleanFromProperties(java.util.Properties p,
java.lang.String propName,
boolean defaultValue)
Gets an boolean out of a properties object. |
static void |
copyProperties(java.util.Properties from,
java.util.Properties to)
Copy the contents from one properties object to another. |
static double |
doubleFromProperties(java.util.Properties p,
java.lang.String propName,
double defaultValue)
Gets a double out of a properties object. |
static float |
floatFromProperties(java.util.Properties p,
java.lang.String propName,
float defaultValue)
Gets an float out of a properties object. |
static java.lang.String[] |
getPropertiesAsStringArray(java.util.Properties props)
Converts a properties object to an array of Strings. |
static java.net.URL |
getResourceOrFileOrURL(java.lang.Class askingClass,
java.lang.String name)
Returns a URL that names either a resource, a local file, or an internet URL. |
static java.net.URL |
getResourceOrFileOrURL(java.lang.Object askingClass,
java.lang.String name)
Returns a URL that names either a resource, a local file, or an internet URL. |
static java.net.URL |
getResourceOrFileOrURL(java.lang.String name)
Returns a URL that names either a resource, a local file, or an internet URL. |
static java.lang.String |
getScopedPropertyPrefix(PropertyConsumer pc)
It seems like every PropertyConsumer wrestles with having a prefix or not. |
static java.lang.String |
getScopedPropertyPrefix(java.lang.String pre)
Given the string, check if it's null. |
static java.lang.String[] |
initPathsFromProperties(java.util.Properties p,
java.lang.String propName)
Takes a string of `;' separated paths and returns an array of parsed strings. |
static java.lang.String[] |
initPathsFromProperties(java.util.Properties p,
java.lang.String propName,
java.lang.String[] defaultPaths)
Takes a string of `;' separated paths and returns an array of parsed strings. |
static int |
intFromProperties(java.util.Properties p,
java.lang.String propName,
int defaultValue)
Gets an integer out of a properties object. |
static boolean |
loadProperties(java.util.Properties properties,
java.io.InputStream propsIn)
Loads properties from a java resource. |
static boolean |
loadProperties(java.util.Properties props,
java.lang.String dir,
java.lang.String file)
Load the named file from the named directory into the given Properties instance. |
static long |
longFromProperties(java.util.Properties p,
java.lang.String propName,
long defaultValue)
Gets a long out of a properties object. |
static java.lang.Object |
objectFromProperties(java.util.Properties p,
java.lang.String propName)
Creates an object out of a property name. |
static java.awt.Color |
parseColor(java.lang.String colorString)
Convert a string representing a 24/32bit hex color value into a Color value. |
static java.awt.Paint |
parseColorFromProperties(java.util.Properties p,
java.lang.String propName,
java.awt.Paint dfault)
Take a string from a properties file, representing the 24bit RGB or 32bit ARGB hex values for a color, and convert it to a java.awt.Color. |
static java.awt.Color |
parseColorFromProperties(java.util.Properties p,
java.lang.String propName,
java.lang.String dfault)
Take a string from a properties file, representing the 24bit RGB or 32bit ARGB hex values for a color, and convert it to a java.awt.Color. |
static java.util.Vector |
parseMarkers(java.lang.String markerList,
java.lang.String delim)
Parse a list of marker names from a space separated list within a String. |
static java.util.Properties |
parsePropertyList(java.lang.String list)
Take a property list, defined in a single string, and return a Properties object. |
static java.util.Properties |
parsePropertyList(java.lang.String list,
java.lang.String propertySeparators,
java.lang.String keyValueSeparators)
Take a property list, defined in a single string, and return a Properties object. |
static java.util.Vector |
parseSpacedMarkers(java.lang.String markerList)
Parse a list of marker names from a space separated list within a String. |
static java.util.Properties |
promptUserForProperties()
A function that brings up a file chooser window in order to have the user look for a valid Java properties file. |
static java.lang.String[] |
stringArrayFromProperties(java.util.Properties p,
java.lang.String propName,
java.lang.String tok)
Takes a string of representing token separated properties and returns an array of parsed strings. |
static java.lang.String |
unnull(java.lang.String prop)
It kills Properties to have null values set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String keyValueSeparators
public static final java.lang.String strictKeyValueSeparators
public static final java.lang.String whiteSpaceChars
public static final java.lang.String propertySeparators
Constructor Detail |
public PropUtils()
Method Detail |
public static java.util.Vector parseSpacedMarkers(java.lang.String markerList)
markerList
- a string containing a space delimited list of
marker names.
public static java.util.Vector parseMarkers(java.lang.String markerList, java.lang.String delim)
markerList
- a string containing a space delimited list of
marker names.delim
- the list of tokens to look for which separate the
list elements.
public static java.util.Properties parsePropertyList(java.lang.String list) throws PropertyStringFormatException
list
- the properties list string.
PropertyStringFormatException
- if a key doesn't have a
value.public static java.util.Properties parsePropertyList(java.lang.String list, java.lang.String propertySeparators, java.lang.String keyValueSeparators) throws PropertyStringFormatException
list
- the properties list string.propertySeparators
- the key-values are assumed to be
separated from other key-value pairs by any character in
this String.keyValueSeparators
- each key is separated from its value
by any character in this String.
PropertyStringFormatException
- if a key doesn't have a
value.public static void copyProperties(java.util.Properties from, java.util.Properties to)
from
- the source Properties object.to
- the destination Properties object.public static boolean loadProperties(java.util.Properties props, java.lang.String dir, java.lang.String file)
Properties
instance. If the file is not found a
warning is issued. If an IOException occurs, a fatal error is
printed.
props
- the instance to receive the loaded propertiesdir
- the directory where the properties file residesfile
- the name of the file
public static boolean loadProperties(java.util.Properties properties, java.io.InputStream propsIn)
properties
- the Properties instance to receive the
properties.propsIn
- an InputStream to read properties from
public static java.util.Properties promptUserForProperties()
public static java.lang.String getScopedPropertyPrefix(PropertyConsumer pc)
public static java.lang.String getScopedPropertyPrefix(java.lang.String pre)
public static java.lang.String unnull(java.lang.String prop)
public static java.lang.String[] initPathsFromProperties(java.util.Properties p, java.lang.String propName)
p
- propertiespropName
- the name of the property
public static java.lang.String[] initPathsFromProperties(java.util.Properties p, java.lang.String propName, java.lang.String[] defaultPaths)
p
- propertiespropName
- the name of the propertydefaultPaths
- the value of the paths to set if the
property doesn't exist, or if is doesn't contain
anything.
public static int intFromProperties(java.util.Properties p, java.lang.String propName, int defaultValue)
p
- propertiespropName
- name of the property associated with the wanted
value.defaultValue
- what to return if the property name doesn't
exist, or if the value isn't a numerical value.
public static float floatFromProperties(java.util.Properties p, java.lang.String propName, float defaultValue)
p
- propertiespropName
- name of the property associated with the wanted
value.defaultValue
- what to return if the property name doesn't
exist, or if the value isn't a numerical value.
public static boolean booleanFromProperties(java.util.Properties p, java.lang.String propName, boolean defaultValue)
p
- propertiespropName
- name of the property associated with the wanted
value.defaultValue
- what to return if the property name doesn't
exist, or if the value isn't a numerical value.
public static java.lang.Object objectFromProperties(java.util.Properties p, java.lang.String propName)
p
- propertiespropName
- name of class to instantiate.
public static java.lang.String[] stringArrayFromProperties(java.util.Properties p, java.lang.String propName, java.lang.String tok)
p
- propertiespropName
- the name of the propertytok
- the characters separating the strings.
public static double doubleFromProperties(java.util.Properties p, java.lang.String propName, double defaultValue)
p
- propertiespropName
- name of the property associated with the wanted
value.defaultValue
- what to return if the property name doesn't
exist, or if the value isn't a numerical value.
public static long longFromProperties(java.util.Properties p, java.lang.String propName, long defaultValue)
p
- propertiespropName
- name of the property associated with the wanted
value.defaultValue
- what to return if the property name doesn't
exist, or if the value isn't a numerical value.
public static java.awt.Color parseColorFromProperties(java.util.Properties p, java.lang.String propName, java.lang.String dfault) throws java.lang.NumberFormatException
p
- propertiespropName
- the name of the propertydfault
- color to use if the property value doesn't work
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integerColorFactory.parseColorFromProperties(Properties, String,
String, boolean)
public static java.awt.Paint parseColorFromProperties(java.util.Properties p, java.lang.String propName, java.awt.Paint dfault)
p
- propertiespropName
- the name of the propertydfault
- color to use if the property value doesn't work
ColorFactory.parseColorFromProperties(Properties, String,
String, boolean)
public static java.awt.Color parseColor(java.lang.String colorString) throws java.lang.NumberFormatException
colorString
- the 24/32bit hex string value (ARGB)
java.lang.NumberFormatException
- if the specified string cannot
be interpreted as a hexidecimal integerColorFactory.parseColor(String, boolean)
public static java.lang.String[] getPropertiesAsStringArray(java.util.Properties props)
props
- the properties object to convert.
public static java.net.URL getResourceOrFileOrURL(java.lang.String name) throws java.net.MalformedURLException
name
- name of the resource, file or URL.
java.net.MalformedURLException
public static java.net.URL getResourceOrFileOrURL(java.lang.Object askingClass, java.lang.String name) throws java.net.MalformedURLException
askingClass
- the object asking for the URL.name
- name of the resource, file or URL.
java.net.MalformedURLException
public static java.net.URL getResourceOrFileOrURL(java.lang.Class askingClass, java.lang.String name) throws java.net.MalformedURLException
askingClass
- the class asking for the URL. Can be null.name
- name of the resource, file or URL.
java.net.MalformedURLException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |