public class PropertiesMap extends Object
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Property
,
BooleanProperty
,
StringProperty
,
IntegerProperty
,
LongProperty
,
FloatProperty
,
DoubleProperty
Modifier and Type | Field and Description |
---|---|
private Map<String,Property> |
propertiesMap
The properties stored in their Hashtable format.
|
Constructor and Description |
---|
PropertiesMap()
Creates a new
PropertiesMap object with an empty map. |
PropertiesMap(Map<String,Property> map)
Creates a new
PropertiesMap object initialized with the given
Map . |
PropertiesMap(PropertiesMap map)
Creates a new
PropertiesMap object initialized with the
given PropertiesMap . |
Modifier and Type | Method and Description |
---|---|
void |
clearProperties()
Removes all properties from the map.
|
protected Object |
clone()
Creates a copy of this
PropertiesMap . |
boolean |
equals(Object object)
Compares the specified
Object with this
PropertiesMap for equality. |
boolean |
getBoolean(String propertyName)
Retrieves the boolean property from the map, returning it to the user.
|
byte |
getByte(String propertyName)
Retrieves the byte property from the map, returning it to the user.
|
char |
getChar(String propertyName)
Retrieves the char property from the map, returning it to the user.
|
double |
getDouble(String propertyName)
Retrieves the double precision floating point property from the map,
returning it to the user.
|
float |
getFloat(String propertyName)
Retrieves the floating point property from the map, returning it to the
user.
|
int |
getInteger(String propertyName)
Retrieves the integer property from the map, returning it to the user.
|
long |
getLong(String propertyName)
Retrieves the long integer property from the map, returning it to the
user.
|
Enumeration<String> |
getProperties()
Returns a list of all of the property names.
|
Property |
getProperty(String propertyName)
Retrieves the property from the map, returning it to the user.
|
short |
getShort(String propertyName)
Retrieves the short property from the map, returning it to the user.
|
String |
getString(String propertyName)
Retrieves the String property from the map, returning it to the user.
|
int |
getType(String propertyName)
Determines the type of property stored in the map, returning it to the
user.
|
boolean |
hasProperty(String propertyName)
Returns whether the given property is contained in the property map.
|
Set<String> |
keySet() |
void |
removeProperty(String propertyName)
Removes the property from the map.
|
void |
setAllProperties(Map<String,Property> map)
Redefines all of the properties to the given
Map unless it is
null . |
void |
setBoolean(String propertyName,
boolean propertyValue)
Stores a boolean property in the map.
|
void |
setByte(String propertyName,
byte propertyValue)
Stores a byte property in the map.
|
void |
setChar(String propertyName,
char propertyValue)
Stores a char property in the map.
|
void |
setDouble(String propertyName,
double propertyValue)
Stores a double precision floating point property in the map.
|
void |
setFloat(String propertyName,
float propertyValue)
Stores a floating point property in the map.
|
void |
setInteger(String propertyName,
int propertyValue)
Stores a integer property in the map.
|
void |
setLong(String propertyName,
long propertyValue)
Stores a long integer property in the map.
|
void |
setProperty(String propertyName,
Property property)
Stores a property in the map.
|
void |
setShort(String propertyName,
short propertyValue)
Stores a short property in the map.
|
void |
setString(String propertyName,
String propertyValue)
Stores a String property in the map.
|
public PropertiesMap()
PropertiesMap
object with an empty map.
Initializes the map of the properties to an empty Hashtable
.public PropertiesMap(Map<String,Property> map)
PropertiesMap
object initialized with the given
Map
. Initializes the map of the properties to the given
Map
unless it is null
. If it is
null
, it initializes the map of the properties to an empty
Hashtable
.map
- The Map
that will be used to initialize the the
new PropertiesMap
if non-null
.public PropertiesMap(PropertiesMap map)
PropertiesMap
object initialized with the
given PropertiesMap
. Initializes the map of the properties
to a clone of the map of the given PropertiesMap
unless it
is null
. If it is null
, it initializes the map
of the properties to an empty Hashtable
.map
- The PropertiesMap
that will be used to initialize
the new PropertiesMap
if non-null
.public void setAllProperties(Map<String,Property> map)
Map
unless it is
null
. All current properties will be lost if the
null
.map
- A Map
that will be used to set the properties if
non-null
.public Property getProperty(String propertyName)
propertyName
- The name of the property to retrieve.public void setProperty(String propertyName, Property property)
propertyName
- The name of the property to store.property
- The property that matches the name given.public boolean getBoolean(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a boolean property.public void setBoolean(String propertyName, boolean propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public short getShort(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a short property.public void setShort(String propertyName, short propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public byte getByte(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a byte property.public void setByte(String propertyName, byte propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public char getChar(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a char property.public void setChar(String propertyName, char propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public String getString(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a String property.public void setString(String propertyName, String propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public int getInteger(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not an integer
property.public void setInteger(String propertyName, int propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public long getLong(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a long integer
property.public void setLong(String propertyName, long propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public float getFloat(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a floating point
property.public void setFloat(String propertyName, float propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public double getDouble(String propertyName) throws PropertyException
propertyName
- The name of the property to retrieve.PropertyException
- If the given property is not a double precision
floating point property.public void setDouble(String propertyName, double propertyValue)
propertyName
- The name of the property to store.propertyValue
- The value of the property that matches the name
given.public int getType(String propertyName)
propertyName
- The name of the property of which we are curious about
the type.Property.BOOLEAN
Property.STRING
Property.INTEGER
Property.LONG
Property.FLOAT
Property.DOUBLE
Property
public boolean hasProperty(String propertyName)
propertyName
- The name of the property that we are checking for.true
if there exists a property with the given name
in the map; false
otherwise.public void removeProperty(String propertyName)
propertyName
- The name of the property to be removed.public Enumeration<String> getProperties()
String
s in an
Enumeration
.public void clearProperties()
public boolean equals(Object object)
Object
with this
PropertiesMap
for equality. The two are equal if and only if
the Object
is an instance of PropertiesMap
and
all of their properties are equal.