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 java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
PropertyDatabase()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ValueType |
decodeProperty(java.lang.String propStr)
Subclasses must define this to instantiate the actual property value from
its string encoding.
|
protected abstract java.lang.String |
encodeProperty(ValueType property)
Subclasses must define this to encode a property as a string for output
to a file.
|
java.util.Collection<java.util.Map.Entry<KeyType,ValueType>> |
entrySet() |
java.util.Set<KeyType> |
getKeys() |
ValueType |
getProperty(KeyType key)
Get a property.
|
boolean |
isEmpty()
Return whether or not the database is empty.
|
protected abstract KeyType |
parseKey(java.lang.String s)
Parse a key from a String.
|
void |
read(java.io.InputStream in)
Read property database from an input stream.
|
void |
readFromFile(java.lang.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(java.io.OutputStream out)
Write property database to an OutputStream.
|
protected abstract void |
writeKey(java.io.Writer writer,
KeyType key)
Write an encoded key to given Writer.
|
void |
writeToFile(java.lang.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 java.util.Set<KeyType> getKeys()
public boolean isEmpty()
public ValueType removeProperty(KeyType key)
key
- the keypublic void readFromFile(java.lang.String fileName) throws java.io.IOException, PropertyDatabaseFormatException
fileName
- name of the database filejava.io.IOException
PropertyDatabaseFormatException
public void read(@WillClose java.io.InputStream in) throws java.io.IOException, PropertyDatabaseFormatException
in
- the InputStreamjava.io.IOException
PropertyDatabaseFormatException
public void writeToFile(java.lang.String fileName) throws java.io.IOException
fileName
- name of the database filejava.io.IOException
public void write(@WillClose java.io.OutputStream out) throws java.io.IOException
out
- the OutputStreamjava.io.IOException
protected abstract KeyType parseKey(java.lang.String s) throws PropertyDatabaseFormatException
s
- a StringPropertyDatabaseFormatException
protected abstract void writeKey(java.io.Writer writer, KeyType key) throws java.io.IOException
writer
- the Writerkey
- the keyjava.io.IOException
protected abstract ValueType decodeProperty(java.lang.String propStr) throws PropertyDatabaseFormatException
propStr
- String containing the encoded propertyPropertyDatabaseFormatException
protected abstract java.lang.String encodeProperty(ValueType property)
property
- the propertyFindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.