|
Joram 5.3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.shared.util.Properties
public class Properties
This class implements a set of properties, which maps keys to values. Only string object can be used as a key, all primitives type can be used as a value.
Constructor Summary | |
---|---|
Properties()
Constructs a new, empty hashtable with a default initial capacity (11) and load factor, which is 0.75. |
|
Properties(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity and default load factor, which is 0.75. |
|
Properties(int initialCapacity,
float loadFactor)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor. |
Method Summary | |
---|---|
void |
clear()
Clears this hashtable so that it contains no keys. |
java.lang.Object |
clone()
Creates a shallow copy of this hashtable. |
boolean |
containsKey(java.lang.String key)
Tests if the specified object is a key in this hashtable. |
void |
copyInto(java.util.Map h)
|
java.util.Enumeration |
elements()
Returns an enumeration of the values in this hashtable. |
java.lang.Object |
get(java.lang.String key)
Returns the value to which the specified key is mapped in this hashtable. |
int |
hashCode()
Returns the hash code value for this Map as per the definition in the Map interface. |
boolean |
isEmpty()
Tests if this hashtable maps no keys to values. |
java.util.Enumeration |
keys()
Returns an enumeration of the keys in this hashtable. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Maps the specified key to the specified value
in this hashtable. |
static Properties |
readFrom(java.io.InputStream is)
The object implements the readFrom method to restore its contents from the input stream. |
protected void |
rehash()
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently. |
java.lang.Object |
remove(java.lang.String key)
Removes the key (and its corresponding value) from this hashtable. |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Calls the method put. |
int |
size()
Returns the number of keys in this hashtable. |
java.lang.String |
toString()
Returns a string representation of this Properties object in the form of a set of entries, enclosed in braces and separated by the ASCII characters ", " (comma and space). |
void |
writeTo(java.io.OutputStream os)
The object implements the writeTo method to write its contents to the output stream. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Properties(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the hashtable.loadFactor
- the load factor of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is less
than zero, or if the load factor is nonpositive.public Properties(int initialCapacity)
initialCapacity
- the initial capacity of the hashtable.
java.lang.IllegalArgumentException
- if the initial capacity is less
than zero.public Properties()
Method Detail |
---|
public int size()
public boolean isEmpty()
true
if this hashtable maps no keys to values;
false
otherwise.public java.util.Enumeration keys()
Enumeration
,
elements()
public java.util.Enumeration elements()
Enumeration
,
Map
public boolean containsKey(java.lang.String key)
key
- possible key.
true
if and only if the specified object
is a key in this hashtable, as determined by the
equals method; false
otherwise.
java.lang.NullPointerException
- if the key is null
.public java.lang.Object get(java.lang.String key)
key
- a key in the hashtable.
null
if the key is not mapped to any value in
this hashtable.
java.lang.NullPointerException
- if the key is null
.protected void rehash()
public java.lang.Object setProperty(java.lang.String key, java.lang.Object value) throws java.lang.ClassCastException
Provided to Enforce the use of primitive type for values. The value returned is the result of the call to put.
key
- the key to be placed into this property object.value
- the value corresponding to key.
java.lang.ClassCastException
public java.lang.Object put(java.lang.String key, java.lang.Object value)
key
to the specified value
in this hashtable. Neither the key nor the value can be null
.
The value can be retrieved by calling the get
method with a
key that is equal to the original key.
Be careful only primitive type can be used as value, in the other case an
exception will be thrown at serialization.
key
- the hashtable key.value
- the value.
null
if it did not have one.
java.lang.NullPointerException
- if the key or value is
null
.Object.equals(Object)
public java.lang.Object remove(java.lang.String key)
key
- the key that needs to be removed.
null
if the key did not have a mapping.
java.lang.NullPointerException
- if the key is null
.public void clear()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
Overrides to toString method of Object.
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Map.hashCode()
public void copyInto(java.util.Map h)
public void writeTo(java.io.OutputStream os) throws java.io.IOException
os
- the stream to write the object to
java.io.IOException
public static Properties readFrom(java.io.InputStream is) throws java.io.IOException
is
- the stream to read data from in order to restore the object
java.io.IOException
|
Joram 5.3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |