public class BufferList extends java.lang.Object implements DetailData
This object can contain a configurable number of items in a buffer. The items kept are rows in a 2 dim array and so the data can be viewed in a table. It is used in jamon to store recent exceptions, and sql queries from the various proxy classes. However it may be used elsewhere. It is thread safe. By default the buffer holds 50 elements, but this can be overridden in the constructor.
It uses a bufferHolder to determine whether a value should be added and another one removed when the buffer is full. For example the value could only be added if the new value is greater than the smallest member of the BufferList. Simply implement the BufferHolder interface to implement your desired rules.Constructor and Description |
---|
BufferList(java.lang.String[] header)
Constructor that takes the header of the structure of the rows that are stored.
|
BufferList(java.lang.String[] header,
BufferHolder bufferHolder)
Pass in the header and bufferHolder to be used
|
BufferList(java.lang.String[] header,
int bufferSize)
Use a FIFOBuffer and specify its header and size
|
BufferList(java.lang.String[] header,
int bufferSize,
BufferHolder bufferHolder)
Specify the header, bufferSize and BufferHolder to be used in the BufferList
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(java.lang.Object obj) |
void |
addRow(java.lang.Object[] row)
Add a row to be held in the buffer.
|
BufferList |
copy() |
void |
disable()
Disable monitoring
|
void |
enable()
Enable monitoring
|
int |
getBufferSize()
Get the number of Exceptions that can be stored in the buffer before the oldest entries must
be removed.
|
java.util.List |
getCollection()
Return the underlying Collection that holds the BufferList
|
java.lang.Object[][] |
getData()
Deprecated.
|
DetailData |
getDetailData() |
java.lang.String[] |
getHeader()
Get the header that can be used to display the buffer.
|
int |
getRowCount()
Return the rows in the BufferList
|
boolean |
hasData()
Return true if the bufferList has data
|
boolean |
isEmpty()
Return true if the bufferList is empty
|
boolean |
isEnabled()
Returns true if MonProxy is enabled.
|
static void |
main(java.lang.String[] args) |
void |
reset()
Reset BufferList.
|
void |
resetBuffer()
Remove all Exceptions from the buffer.
|
void |
setBufferHolder(BufferHolder bufferHolder) |
void |
setBufferSize(int newBufferSize)
Set the number of Exceptions that can be stored in the buffer before the oldest entries must
be removed.
|
public BufferList(java.lang.String[] header)
header
- public BufferList(java.lang.String[] header, BufferHolder bufferHolder)
public BufferList(java.lang.String[] header, int bufferSize)
public BufferList(java.lang.String[] header, int bufferSize, BufferHolder bufferHolder)
public int getBufferSize()
public void setBufferHolder(BufferHolder bufferHolder)
public void setBufferSize(int newBufferSize)
public void resetBuffer()
public boolean isEmpty()
public boolean hasData()
public int getRowCount()
public java.util.List getCollection()
public boolean isEnabled()
public void enable()
public void disable()
public void reset()
public java.lang.String[] getHeader()
getHeader
in interface DetailData
public java.lang.Object[][] getData()
getData
in interface DetailData
public DetailData getDetailData()
public void addRow(java.lang.Object[] row)
public void addRow(java.lang.Object obj)
public BufferList copy()
public static void main(java.lang.String[] args)