public class FwkPropertyFile extends java.util.Properties implements FwkInterface, java.util.Map<java.lang.Object,java.lang.Object>
The properties can deliver different types of objects. The following types are defined:
Type | Classname | Default value |
---|---|---|
String | java.lang.String | null |
Long | java.lang.Long | 0 |
Double | java.lang.Double | 0.0 |
Font | java.awt.Font | null |
Color | java.awt.Color | null |
The class determines the name of the node and the username. The properties which are stored get the prefix [node].[username].[type].key. The search order of the keys is:
1. | node.username.type.key |
2. | username.type.key |
3. | node.type.key |
4. | type.key |
5. | key |
If the key isn't found null
is returned for objects
and the value 0 is returned otherwise.
The resource files will be loaded in following order. If one step loads the file successfully it stops the chain.
as file | FwkContainer.getSystemProperty(resource+".Properties") |
as URL | FwkContainer.getSystemProperty(resource+".Properties") |
as file | PropertyBus.getProperty(resource+".Properties") |
as URL | PropertyBus.getProperty(resource+".Properties") |
as file | resource+".properties_de_DE" |
as URL | ClassLocation/resource+".properties_de_DE" |
as file | resource+".properties" |
as file | resource+".properties_de" |
as file | resource+".properties_DE" |
as URL | ClassLocation/resource+".properties" |
as URL | ClassLocation/resource+".properties_de" |
as URL | ClassLocation/resource+".properties_DE" |
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
version |
Constructor and Description |
---|
FwkPropertyFile() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String[] |
createKeys(java.lang.String key)
Create a list with possible keys.
|
protected java.lang.String[] |
createKeys(java.lang.String type,
java.lang.String key)
Create a list with possible keys.
|
protected java.lang.String |
createUserKey(java.lang.String key)
Create a user key.
|
protected java.lang.String |
createUserKey(java.lang.String type,
java.lang.String key)
Create a user key.
|
boolean |
fileLoad(java.lang.String filename,
java.lang.ClassLoader loader)
Reads a property list (key and element pairs) from the input stream.
|
protected java.lang.ClassLoader |
getClassLoader(java.lang.Class clazz) |
FwkArrayInterface |
getFwkMimeTypes() |
protected java.io.InputStream |
getInputStream(java.lang.String filename,
java.lang.ClassLoader classLoader) |
java.lang.Object |
getObject(java.lang.String key)
Get an object for the property key.
|
java.lang.Object |
getObject(java.lang.String type,
java.lang.String key)
Get an object for the property key.
|
java.lang.String |
getParams()
This function returns a string containing all parameters
of the object.
|
java.lang.String |
getVersion()
Return the version string of the FWK component.
|
boolean |
load(java.lang.String filename)
Reads a property list (key and element pairs) from the input stream.
|
boolean |
load(java.lang.String resource,
java.lang.Class clazz)
Reads a property list (key and element pairs) from the input stream.
|
boolean |
load(java.lang.String resource,
java.lang.String className,
java.lang.ClassLoader loader)
Reads a property list (key and element pairs) from the input stream.
|
boolean |
load(java.net.URL url)
Reads a property list (key and element pairs) from the input stream.
|
void |
release()
Release the object.
|
protected java.lang.Object |
searchForProperty(java.lang.String[] keyList)
Search for the property.
|
java.lang.String |
toString()
Get the string representation of the object.
|
boolean |
urlLoad(java.lang.String urlString)
Reads a property list (key and element pairs) from the input stream.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, values
public static final java.lang.String version
public java.lang.String getVersion()
FwkInterface
getVersion
in interface FwkInterface
public FwkArrayInterface getFwkMimeTypes()
public void release()
release
in interface FwkInterface
protected java.lang.String[] createKeys(java.lang.String key)
key
- The key (type is a part of the key).protected java.lang.String[] createKeys(java.lang.String type, java.lang.String key)
type
- The type of the key.key
- The key.protected java.lang.String createUserKey(java.lang.String type, java.lang.String key)
type
- The type of the key.key
- The key.protected java.lang.String createUserKey(java.lang.String key)
key
- The key.public java.lang.String getParams()
public java.lang.Object getObject(java.lang.String key)
key
- The key of the propery.public java.lang.Object getObject(java.lang.String type, java.lang.String key)
type
- The type of the object.key
- The key of the propery.protected java.lang.ClassLoader getClassLoader(java.lang.Class clazz)
protected java.io.InputStream getInputStream(java.lang.String filename, java.lang.ClassLoader classLoader)
public boolean load(java.lang.String resource, java.lang.Class clazz)
resource
- Name of the property resource.clazz
- The class to determine the class loader. Could be null.public boolean fileLoad(java.lang.String filename, java.lang.ClassLoader loader)
filename
- Name of the property file.loader
- The class loadler. Could be null.public boolean urlLoad(java.lang.String urlString)
urlString
- Name of the property file.public boolean load(java.lang.String resource, java.lang.String className, java.lang.ClassLoader loader)
resource
- Name of the property resource.className
- The name of the class.loader
- The class loader. Could be null.public boolean load(java.lang.String filename)
filename
- Name of the property file.public boolean load(java.net.URL url)
url
- Name of the property url.protected java.lang.Object searchForProperty(java.lang.String[] keyList)
keyList
- The list with the keys in the search order.public java.lang.String toString()
toString
in class java.util.Hashtable<java.lang.Object,java.lang.Object>