KeyType - key type: either MethodDescriptor or FieldDescriptorValueType - value type: a value that summarizes some property of the
associated keypublic abstract class PropertyDatabase<KeyType extends FieldOrMethodDescriptor,ValueType> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
PropertyDatabase()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract ValueType |
decodeProperty(String propStr)
Subclasses must define this to instantiate the actual property value from
its string encoding.
|
protected abstract String |
encodeProperty(ValueType property)
Subclasses must define this to encode a property as a string for output
to a file.
|
Collection<Map.Entry<KeyType,ValueType>> |
entrySet() |
Set<KeyType> |
getKeys() |
ValueType |
getProperty(KeyType key)
Get a property.
|
boolean |
isEmpty()
Return whether or not the database is empty.
|
protected abstract KeyType |
parseKey(String s)
Parse a key from a String.
|
void |
read(InputStream in)
Read property database from an input stream.
|
void |
readFromFile(String fileName)
Read property database from given file.
|
ValueType |
removeProperty(KeyType key)
Remove a property.
|
void |
setProperty(KeyType key,
ValueType property)
Set a property.
|
void |
write(OutputStream out)
Write property database to an OutputStream.
|
protected abstract void |
writeKey(Writer writer,
KeyType key)
Write an encoded key to given Writer.
|
void |
writeToFile(String fileName)
Write property database to given file.
|
protected PropertyDatabase()
public void setProperty(KeyType key, ValueType property)
key - the keyproperty - the property@CheckForNull public ValueType getProperty(KeyType key)
key - the keypublic Collection<Map.Entry<KeyType,ValueType>> entrySet()
public boolean isEmpty()
public ValueType removeProperty(KeyType key)
key - the keypublic void readFromFile(String fileName) throws IOException, PropertyDatabaseFormatException
fileName - name of the database fileIOExceptionPropertyDatabaseFormatExceptionpublic void read(@WillClose InputStream in) throws IOException, PropertyDatabaseFormatException
in - the InputStreamIOExceptionPropertyDatabaseFormatExceptionpublic void writeToFile(String fileName) throws IOException
fileName - name of the database fileIOExceptionpublic void write(@WillClose OutputStream out) throws IOException
out - the OutputStreamIOExceptionprotected abstract KeyType parseKey(String s) throws PropertyDatabaseFormatException
s - a StringPropertyDatabaseFormatExceptionprotected abstract void writeKey(Writer writer, KeyType key) throws IOException
writer - the Writerkey - the keyIOExceptionprotected abstract ValueType decodeProperty(String propStr) throws PropertyDatabaseFormatException
propStr - String containing the encoded propertyPropertyDatabaseFormatExceptionCopyright © 2003–2015. All rights reserved.