public class PropertyList extends mVector implements HasProperties
Modifier and Type | Class and Description |
---|---|
static class |
PropertyList.NullPropertyList |
Modifier and Type | Field and Description |
---|---|
static PropertyList |
nullPropertyList |
capacityIncrement, elementCount, elementData
serialVersionUID
Constructor and Description |
---|
PropertyList() |
PropertyList(Object[] nameAndValues) |
Modifier and Type | Method and Description |
---|---|
boolean |
_getSetField(String name,
Wrapper data,
boolean isGet) |
boolean |
add(Object[] nameAndValues) |
boolean |
add(Property prop)
Adds a non-exclusive property. i.e. more than one property with that name can exist.
|
boolean |
add(PropertyList prop) |
boolean |
add(String props,
Object value)
Adds a non-exclusive property. i.e. more than one property with that name can exist.
|
void |
defaultTo(String nameAndValues) |
boolean |
defaultTo(String name,
Object value) |
void |
fromHashtable(Hashtable source)
Put the values in the Hashtable into the PropertyList.
|
static PropertyList |
fromStrings(String s) |
Property |
get(String name)
Get the property with the specified name.
|
Property |
get(String name,
Property previous)
Get the property with the specified name, starting with the previous one.
|
static boolean |
getBoolean(Object propertyListOrStrings,
String name,
boolean defaultValue)
This first converts the propertyListOrStrings parameters into a valid or empty PropertyList
and then calls getBoolean(name,defaultValue) on that list.
|
boolean |
getBoolean(String name,
boolean def) |
static double |
getDouble(Object propertyListOrStrings,
String name,
double defaultValue)
This first converts the propertyListOrStrings parameters into a valid or empty PropertyList
and then calls getDouble(name,defaultValue) on that list.
|
double |
getDouble(String name,
double def) |
static int |
getInt(Object propertyListOrStrings,
String name,
int defaultValue)
This first converts the propertyListOrStrings parameters into a valid or empty PropertyList
and then calls getInt(name,defaultValue) on that list.
|
int |
getInt(String name,
int def) |
long |
getLong(String name,
long def) |
String[] |
getNames() |
PropertyList |
getProperties()
This returns itself.
|
static PropertyList |
getProperties(Object obj) |
Iterator |
getProperties(String prop)
Return an Enumeration of all the properties with a given name.
|
Vector |
getPropertyValues(String propertyName)
Gather all the property values with a certain name into a Vector.
|
static boolean |
getSetProperties(Object obj,
String name,
Wrapper data,
boolean isGet) |
static String |
getString(Object propertyListOrStrings,
String name,
String defaultValue)
This first converts the propertyListOrStrings parameters into a valid or empty PropertyList
and then calls getString(name,defaultValue) on that list.
|
String |
getString(String name,
String deflt) |
String[] |
getStrings(String props,
String defaultValue)
Gets a set of properties, each associated with a string.
|
Object |
getValue(Class aClass,
Object defaultValue) |
static Object |
getValue(Object propertyListOrStrings,
String name,
Object defaultValue)
This first converts the propertyListOrStrings parameters into a valid or empty PropertyList
and then calls getValue(name,defaultValue) on that list.
|
Object |
getValue(String[] v,
Object deflt)
Gets the value of a property which may be named differently (e.g.
|
Object |
getValue(String name,
Object deflt)
Gets the value of a property, with a default if it does not exist.
|
Object |
getValue(Vector v,
Object deflt)
Gets the value of a property which may be named differently (e.g.
|
static PropertyList |
make(String from)
This will create a new PropertyList and call setStrings() on it.
|
void |
readConfigFile(BufferedReader br) |
boolean |
remove(String props)
Removes all properties with the name.
|
PropertyList |
set(Class aClass,
Object value)
This does: set(aClass.getName(),value);
|
boolean |
set(Property prop)
Sets an exclusive property. i.e. only one property with that name can exist.
|
boolean |
set(PropertyList pl) |
boolean |
set(String props,
Object value)
Sets an exclusive property. i.e. only one property with that name can exist.
|
boolean |
setBoolean(String name,
boolean value) |
PropertyList |
setClassValue(Object obj)
This calls set(obj.getClass(),obj); if obj is not null.
|
boolean |
setDouble(String name,
double value) |
boolean |
setInt(String name,
int value) |
boolean |
setLong(String name,
long value) |
boolean |
setStrings(String propsAndValues)
Sets a set of properties, each associated with a string.
|
Hashtable |
toHashtable(Hashtable destination)
Put the PropertyList values into a Hashtable.
|
static PropertyList |
toPropertyList(Object propertyListOrStrings)
This will convert a set of properties encoded as Strings separated by '|' characters into a PropertyList
OR it will return the PropertyList if the parameter implements HasProperties, OR it will return a nullPropertyList object
|
add, add, addAll, addAll, addAll, addAll, addCopiesFrom, cacheAllElements, clear, compareTo, copied, copyCopiesFrom, copyFrom, copyInto, copyInto, del, find, get, getCopy, getCount, getFullCopy, getNew, insert, iterator, newVector, pop, push, size, toArray, toArray, toArray, toArray, toArray, toObjectArray, toString
add, addAll, addAll, addElement, capacity, clone, contains, containsAll, elementAt, elements, ensureCapacity, firstElement, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setElementAt, setSize, size, trimToSize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
public static final PropertyList nullPropertyList
public PropertyList(Object[] nameAndValues)
public PropertyList()
public PropertyList getProperties()
getProperties
in interface HasProperties
public boolean add(Object[] nameAndValues)
public void defaultTo(String nameAndValues)
public boolean setBoolean(String name, boolean value)
public boolean setInt(String name, int value)
public boolean setLong(String name, long value)
public boolean setDouble(String name, double value)
public boolean getBoolean(String name, boolean def)
public double getDouble(String name, double def)
public int getInt(String name, int def)
public long getLong(String name, long def)
public Property get(String name, Property previous)
public Object getValue(String name, Object deflt)
public Object getValue(Vector v, Object deflt)
public Object getValue(String[] v, Object deflt)
public boolean set(Property prop)
public boolean set(String props, Object value)
public boolean set(PropertyList pl)
public boolean setStrings(String propsAndValues)
public String[] getStrings(String props, String defaultValue)
public boolean add(Property prop)
public boolean add(PropertyList prop)
public boolean add(String props, Object value)
public boolean remove(String props)
public static PropertyList make(String from)
from
- The encoded PropertyValues.setStrings()
public String[] getNames()
public static PropertyList fromStrings(String s)
public static PropertyList getProperties(Object obj)
public static boolean getSetProperties(Object obj, String name, Wrapper data, boolean isGet)
public static PropertyList toPropertyList(Object propertyListOrStrings)
propertyListOrStrings
- If this is a String it will be decoded usingpublic static Object getValue(Object propertyListOrStrings, String name, Object defaultValue)
propertyListOrStrings
- name
- defaultValue
- public static int getInt(Object propertyListOrStrings, String name, int defaultValue)
public static double getDouble(Object propertyListOrStrings, String name, double defaultValue)
public static boolean getBoolean(Object propertyListOrStrings, String name, boolean defaultValue)
public static String getString(Object propertyListOrStrings, String name, String defaultValue)
public Vector getPropertyValues(String propertyName)
public Iterator getProperties(String prop)
public void readConfigFile(BufferedReader br) throws IOException
IOException
public Hashtable toHashtable(Hashtable destination)
destination
- the destination Hashtable or null to return a new one.public void fromHashtable(Hashtable source)
source
- the source Hashtable.public PropertyList set(Class aClass, Object value)
aClass
- a non-null class.value
- the value to associate with that class which must be an instance of that class.public Object getValue(Class aClass, Object defaultValue)
aClass
- a non-null class.defaultValue
- the value to return if no value of the specified name is found.public PropertyList setClassValue(Object obj)
obj
- the object to assign to the class name in the PropertyList.