com.partnersoft.v3x.data
Class DataRecordSource
java.lang.Object
com.partnersoft.v3x.data.DataRecordSource
- Direct Known Subclasses:
- StakingBuddyDataRecordSource, StreamingDataRecordSource, XMLDataRecordSource
public abstract class DataRecordSource
- extends java.lang.Object
A source for data records, represented as a Map object that iterates over the
dataset. Usually the data is tabular; each record has the same keys.
Here is an example of use:
DataSourceMap source = new DataSourceMapSubclass();
while (source.hasNext()) {
source.next();
System.out.println(source.get("something"));
}
Note that it implements both Map and Iterator; the iterator returns itself as
next(), so we don't have to bother casting it above but this does facilitate
reuse with functions that take iterators.
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
verbose
protected boolean verbose
showProgress
protected boolean showProgress
parameters
protected java.util.Map parameters
iteratorWrapper
public java.util.Iterator iteratorWrapper
mapWrapper
public java.util.Map mapWrapper
DataRecordSource
public DataRecordSource()
getParameters
public java.util.Map getParameters()
setParameters
public void setParameters(java.util.Map newParams)
initialize
protected abstract void initialize(java.util.ArrayList fieldNames)
- Subclasses must implement this to set themselves up and populate the
fieldNames list. The list is empty to start with.
nextRecord
protected abstract boolean nextRecord(java.util.ArrayList fillThis)
- Subclasses must implement this to set the current values in the given
arraylist. While this does require pulling all values from e.g. a
ResultSet, it prevents oddities such as the can-only-fetch-once bug in
MSAccess. The list will already be populated with values, so set(index,
value) will work for all indices (assuming your record is the same size
as the fieldNames list, of course). It is not nulled out, so be sure to
set all values. This is done as a prefetch; return true if the prefetch
succeeds.
close
public void close()
- Do any cleanup needed. Be sure to call super.close().
reset
public void reset()
getPosition
public int getPosition()
fieldNames
public java.util.ArrayList fieldNames()
fieldValues
public java.util.ArrayList fieldValues()
asIterator
public java.util.Iterator asIterator()
asMap
public java.util.Map asMap()
hasNext
public boolean hasNext()
initialize
public void initialize()
next
public java.lang.Object next()
remove
public void remove()
setTransformScript
public void setTransformScript(java.lang.String newScript)
getTransformScript
public java.lang.String getTransformScript()
getTransforms
public java.util.ArrayList getTransforms()
setTransforms
public void setTransforms(java.util.ArrayList newTransforms)
getBeforeActions
public java.util.ArrayList getBeforeActions()
setBeforeActions
public void setBeforeActions(java.util.ArrayList newBeforeActions)
getAfterActions
public java.util.ArrayList getAfterActions()
setAfterActions
public void setAfterActions(java.util.ArrayList newAfterActions)
copyStateFrom
protected void copyStateFrom(java.lang.Object nother)
clone
public java.lang.Object clone()
- Overrides:
clone in class java.lang.Object
size
public int size()
get
public java.lang.Object get(java.lang.Object key)
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
remove
public java.lang.Object remove(java.lang.Object key)
isEmpty
public boolean isEmpty()
containsKey
public boolean containsKey(java.lang.Object key)
containsValue
public boolean containsValue(java.lang.Object value)
putAll
public void putAll(java.util.Map map)
clear
public void clear()
keySet
public java.util.Set keySet()
entrySet
public java.util.Set entrySet()
getContentsMap
public java.util.Map getContentsMap()
values
public java.util.Collection values()
isVerbose
public boolean isVerbose()
setVerbose
public void setVerbose(boolean tizit)
getShowProgress
public boolean getShowProgress()
setShowProgress
public void setShowProgress(boolean tizit)