All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class guinea.logic.ItemProperties

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----java.util.Properties
                           |
                           +----guinea.util.ExtProperties
                                   |
                                   +----guinea.logic.ItemProperties

public class ItemProperties
extends ExtProperties
An extension to the properties class that creates a subset of propery names.

Example on how this thing works: 'props1' is an object of java.util.Properties containing properties:

{ foo:  frog
bar:  dog
foo.bar:  goat
foo.fii:  bonk
bar.bar:  egg
foo.bar.baz: snake
foo.bar.foo: oil
}
then:
props1.getProperty("foo") -> "flog"
props1.getProperty("bar") -> "dog"
props1.getProperty("foo.bar") -> "goat"
props1.propertyNames() -> { "foo", "bar", "foo.bar", "foo.fii", 
"bar.bar", "foo.bar.baz", "foo.bar.foo" }
Now if:
props2 = new ItemProperties("foo", props1)
and
props3 = new ItemProperties("bar", props1)
then:
props2.getProperty("foo") -> null
props2.getProperty("bar") -> "goat"
props2.getProperty("bar.baz" -> "snake"
props2.propertyNames() -> { "bar", "fii", "bar.baz", "bar.foo" }
props3.getProperty("bar") -> "egg"
props3.propertyNames() -> { "bar" }
and if:
props4 = new ItemProperties("bar", props2);
then:
props4.getProperty("bar") -> null
props4.getProperty("foo") -> "oil"
props2.propertyNames() -> { "baz", "foo" }

See Also:
Properties

Constructor Index

· ItemProperties()
Construct a new properties object.
· ItemProperties(String)
Construct a new properties object.
· ItemProperties(String, Properties)

Method Index

· getName()
· getProperty(String)
Searches for the property with the specified key in this property list.
· getProperty(String, String)
Searches for the property with the specified key in this property list.
· numProperties()
Get number of properties in this properties list.
· propertyNames()
Return an enumeration of all the keys in the property list.
· put(Object, Object)
Maps the specified key to the specified value in this hashtable.

Constructors

· ItemProperties
 public ItemProperties()
Construct a new properties object.

· ItemProperties
 public ItemProperties(String name)
Construct a new properties object.

Parameters:
name - Hmm...
· ItemProperties
 public ItemProperties(String name,
                       Properties defaults)

Methods

· getName
 public String getName()
· getProperty
 public String getProperty(String pname)
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns null if the property is not found.

Parameters:
pname - The property name.
Returns:
The value in this property list with the specified key value.
Overrides:
getProperty in class Properties
· getProperty
 public String getProperty(String pname,
                           String def)
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.

Parameters:
pname - The property name.
def - A default value.
Returns:
The value in this property list with the specified key value.
Overrides:
getProperty in class Properties
· put
 public Object put(Object key,
                   Object value)
Maps the specified key to the specified value in this hashtable.

Overrides:
put in class Hashtable
· propertyNames
 public Enumeration propertyNames()
Return an enumeration of all the keys in the property list.

Returns:
an enumeration of all the keys in the property list.
Overrides:
propertyNames in class Properties
· numProperties
 public int numProperties()
Get number of properties in this properties list.

Returns:
Number of properties.

All Packages  Class Hierarchy  This Package  Previous  Next  Index