|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.functest.config.Checksummer<T>
T
- The type of object to be hashed.@NotThreadSafe public class Checksummer<T>
Keeps the checksums of a group of objects of type T.
Nested Class Summary | |
---|---|
static interface |
Checksummer.Helper<T>
Helps with the conversion of T into and from its different forms needed for the operation of the checksummer. |
Constructor Summary | |
---|---|
Checksummer(Checksummer.Helper<T> helper)
Create a checksummer that uses the passed helper to covert T to and from a form that allows it to be serialized. |
|
Checksummer(Checksummer.Helper<T> helper,
String defaultSum)
Create a checksummer that uses the passed helper to convert T to and from a form that allows it to be serialized. |
Method Summary | |
---|---|
static Checksummer<File> |
fileChecksummer(String hash)
Static factory method that will create a checksum that stores File objects by hashing their
contents. |
String |
getDefaultSum()
Return the hash algorithm used when adding new objects to the checkum. |
boolean |
hasChanged(T object)
Tells the caller if the passed object has a hash the same as the one already stored in the checksum. |
boolean |
isModified()
Return true if the checksummer was modified since write(org.dom4j.Element) was called, false otherwise. |
void |
read(org.dom4j.Element element)
Read the checksummer state as was previously saved using write(org.dom4j.Element) . |
boolean |
remove(T object)
Remove the passed object and its hash from checksummer. |
void |
setDefaultSum(String defaultSum)
Set the default hash algorithm used when adding new objects. |
boolean |
update(T object)
Update the current state of the passed object with its current hash. |
void |
write(org.dom4j.Element checkElement)
Write the current state of the checksummer to the passed element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Checksummer(Checksummer.Helper<T> helper)
helper
- the helper this checksum will use to process instances of T.public Checksummer(Checksummer.Helper<T> helper, String defaultSum)
helper
- the helper this checksum will use to process instance of T.defaultSum
- the checksum used to add any new objects.Method Detail |
---|
public static Checksummer<File> fileChecksummer(String hash)
File
objects by hashing their
contents. This can be used to find out quickly from a set of files which have changed.
hash
- the checksum oused to add any new objects.
File
objects.public String getDefaultSum()
public void setDefaultSum(String defaultSum)
defaultSum
- the default hash algorithm used when adding new objects.public boolean hasChanged(T object)
object
- the object to test.
public boolean isModified()
write(org.dom4j.Element)
was called, false otherwise.
write(org.dom4j.Element)
was called, false otherwise.public boolean update(T object)
object
- the object to update or add.
public boolean remove(T object)
object
- the object to remove from the checksummer.
public void read(org.dom4j.Element element)
write(org.dom4j.Element)
.
element
- the element where the configuration is stored.public void write(org.dom4j.Element checkElement)
read(org.dom4j.Element)
.
checkElement
- the element to write the state to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |