|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jclass.ResourceHash
A class that allows a good maintenance of a set of constants.
It basically does nothing more than storing a vector of strings
representing the names of the resources and another vector representing
the values of the same resources.
Note: The code herein is vvv ugly ...
Written: Radu Sion
Version: 0.18
Source: ResourceHash.java
Visit
Smart Software
Constructor Summary | |
ResourceHash(SimpleProperties p)
Creates a resource hash from a properties object. |
|
ResourceHash(java.util.Vector names,
java.util.Vector values)
Creates a new object. |
Method Summary | |
static ResourceHash |
fromFile(java.lang.String filename)
Reads a resource file and returnes the resources into a ResourceHash for later use from inside the calling program. |
int |
getBoolean(java.lang.String resname)
Returns the first occurence of a resource value interpreted as a boolean. |
java.lang.Double |
getDouble(java.lang.String resname)
Returns the first occurence of a resource value interpreted as a double. |
double |
getDoubleValue(java.lang.String resname)
Returns a double representing the value of the above .getDouble() returned Double object. |
java.lang.Long |
getLong(java.lang.String resname)
Returns the first occurence of a resource value interpreted as a Long. |
long |
getLongValue(java.lang.String resname)
Returns a long representing the value of the above .getLong() returned Long object. |
java.lang.String |
getString(java.lang.String resname)
Returns the first occurence of a resource value treated as a string with the given name. |
java.lang.String |
HREF="../jclass/ResourceHash.html#set(java.lang.String, java.lang.String)">set(java.lang.String resname,
java.lang.String resvalue)
Sets the named resource value, but only if it already exists here with another value. |
int |
size()
Returns the size of this structure, actually the length of the internal arrays that hold the resources. |
SimpleProperties |
toSimpleProperties()
Returns a corresponding properties object, containing everything in this resource hash. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ResourceHash(java.util.Vector names, java.util.Vector values)
names
- A Vector containing the resource names as String objectsvalues
- A Vector containing the resource string values as String objectspublic ResourceHash(SimpleProperties p)
Method Detail |
public SimpleProperties toSimpleProperties()
public int size()
public java.lang.String set(java.lang.String resname, java.lang.String resvalue)
resname
- Resource name to consider (case senzitive)resvalue
- Resource value to setpublic java.lang.String getString(java.lang.String resname)
resname
- Resource name to consider (case senzitive)public int getBoolean(java.lang.String resname)
true: ok, enabled, true, on false: disabled, false, off
resname
- Resource name to consider (case senzitive)public java.lang.Long getLong(java.lang.String resname)
resname
- Resource name to consider (case senzitive)public long getLongValue(java.lang.String resname)
resname
- Resource name to considerpublic java.lang.Double getDouble(java.lang.String resname)
resname
- Resource name to consider (case senzitive)public double getDoubleValue(java.lang.String resname)
resname
- Resource name to considerpublic static ResourceHash fromFile(java.lang.String filename)
# comment line Resource1 valueofresource1 Resource2 valueofresource2 Resource3 " string value of resource 3 "
filename
- Resource file name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |