|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.util.StringHistory
public final class StringHistory
Utility class that keeps a list of recently used String, mostly used in File-Reader and Writer that keep track of a list of recently accessed file names. This class also makes sure that the list is made persistent and saved to disk when the application closes. The list is read again from file on startup.
Usage in a short way: Determine a (possibly unique) ID for your
history to use (I assume that there are not that many?) and get a history
object by invoking StringHistory.getInstance(yourID)
. You
can add recently used String to this object by invoking the
add(String)
method and get a list of String from the
getHistory()
method which will return the history in the order
the add method on the String objects has been called with the last element
added being the first element in the history result.
Method Summary | |
---|---|
void |
add(String str)
Adds a new String to the history. |
String[] |
getHistory()
Get the history in an array with the most recently added element first. |
static StringHistory |
getInstance(String id)
Get a history for an ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static StringHistory getInstance(String id)
id
- The ID of interest
public void add(String str)
getHistory()
str
- The string to add.
NullPointerException
- If argument is null.public String[] getHistory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |