joperties
Class Joperties
java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<java.lang.Object,java.lang.Object>
java.util.Properties
joperties.Joperties
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>
public class Joperties
- extends java.util.Properties
This class subclasses the Properties class and provides methods for setting
and retrieving java objects instead of Strings.
- Author:
- Savvas Dalkitsis
- See Also:
- Serialized Form
Fields inherited from class java.util.Properties |
defaults |
Method Summary |
|
getJoperty(java.lang.String key,
AbstractInterpreter<T> interpreter)
This method interprets the value of the provided key as an object of the
class provided. |
|
getJoperty(java.lang.String key,
java.lang.Class<T> getAsClass)
This method interprets the value of the provided key as an object of the
class provided. |
|
setJoperty(java.lang.String key,
T value)
This method sets the provided object as the value of the provided key. |
|
setJoperty(java.lang.String key,
T value,
AbstractInterpreter<T> interpreter)
This method sets the provided object as the value of the provided key. |
Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
Joperties
public Joperties()
getJoperty
public <T> T getJoperty(java.lang.String key,
java.lang.Class<T> getAsClass)
throws NoApropriateInterpeterFoundException,
InterpretationException
- This method interprets the value of the provided key as an object of the
class provided.
- Type Parameters:
T
- The type of the class to interpret as.- Parameters:
key
- The property key.getAsClass
- The class to interpret the value as.
- Returns:
- An object of the class provided that is the interpreted value.
- Throws:
NoApropriateInterpeterFoundException
- If no registered interpreter was found for the provided
class.
InterpretationException
- If there was an error interpreting the value.
getJoperty
public <T> T getJoperty(java.lang.String key,
AbstractInterpreter<T> interpreter)
throws InterpretationException,
NoApropriateInterpeterFoundException
- This method interprets the value of the provided key as an object of the
class provided.
- Type Parameters:
T
- The type of the class to interpret as.- Parameters:
key
- The property key.interpreter
- The interpreter to use.
- Returns:
- An object of the class provided that is the interpreted value.
- Throws:
InterpretationException
- If there was an error interpreting the value.
NoApropriateInterpeterFoundException
- If null is passed as the interpreter.
setJoperty
public <T> void setJoperty(java.lang.String key,
T value)
throws EncodingException,
NoApropriateInterpeterFoundException
- This method sets the provided object as the value of the provided key. It
searches for a registered interpreted which encodes the object to a
string which is set as the value.
- Type Parameters:
T
- The type of the provided object.- Parameters:
key
- The property key.value
- The object to encode and set as the value.
- Throws:
EncodingException
- If there was an error encoding the object.
NoApropriateInterpeterFoundException
- If no registered interpreter was found for the provided
class.
setJoperty
public <T> void setJoperty(java.lang.String key,
T value,
AbstractInterpreter<T> interpreter)
throws EncodingException,
NoApropriateInterpeterFoundException
- This method sets the provided object as the value of the provided key. It
uses the provided interpreted which encodes the object to a string which
is set as the value.
- Type Parameters:
T
- The type of the provided object.- Parameters:
key
- The property key.value
- The object to encode and set as the value.interpreter
- The interpreter to use to encode the object.
- Throws:
EncodingException
- If there was an error encoding the object.
NoApropriateInterpeterFoundException
- If null is passed as the interpreter.