|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<LogEvent>
de.infinityloop.util.log.LogEventCollector
public class LogEventCollector
A NotificationCollector is used for globally collecting notifications, errors, warnings over the app's run to be able to identify them later in some collected form for evaluation.
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
LogEventCollector(java.lang.String name,
LogBroadcaster lb,
de.infinityloop.util.log.helpers.LogEventFilter f)
|
|
LogEventCollector(java.lang.String name,
de.infinityloop.util.log.helpers.LogEventFilter f)
Constructors |
|
| Method Summary | |
|---|---|
void |
addedTo(LogBroadcaster le)
Called when this object is successfully attached to a LogPublisher. |
void |
addLogListener(LogListener ls)
Call to attach a Listener for log events received by the LogBroadcaster. |
LogEvent |
broadcast(LogEvent le)
Method to dispatch the specified log event to all registered listeners on this broadcaster. |
void |
clear()
Clears all collected notifications. |
int |
countType(int type)
Counts the number of messages in this collection of the respective type |
boolean |
equals(java.lang.Object o)
We MUST override equals() since the behaviour of the inherited method of ArrayList is not what we require. |
LogEventCollector |
extractSignificantEntries(int[] types,
int[] including,
int[] excluding)
This method tells whether this exception contains a LogEvent that is significant for you. |
LogEventCollector |
extractSignificantEntries(de.infinityloop.util.log.helpers.LogEventFilter f)
Return the entries that are matched by the specified LogEventFilter. |
java.lang.String |
getAsString()
human readable representation of the collected notifications |
int |
getCode(int i)
|
java.lang.Throwable |
getEmbeddedException(int i)
|
LogEventCollector |
getEntriesByType(int type)
Returns an ArrayList object that holds all those LogEntry objects that are of the specified type. |
LogEvent |
getEntryByCode(int code)
Returns the (first) entry with the specified code or null if that message is not contained in this exception. |
de.infinityloop.util.log.helpers.LogEventFilter |
getFilter()
Returns the incoming filter instance active for this LogEventCollector. |
LogEvent |
getLogEvent(int i)
Retrieve the ith collected LogEvent. |
java.lang.String |
getMessage(int i)
|
java.util.ArrayList |
getNotifications()
Returns the collected notifications |
java.lang.Object[] |
getParameters(int i)
retrieves the parameter objects for the respective error message |
int |
hashCode()
We MUST override the default hash function as that changes with changing the list entries, which we do not want! |
boolean |
receiveLogEvent(LogEvent le)
Receive a LogEvent from a publisher we are registered to. |
void |
removeAllSubscribers()
This method unregisters all LogSubscriber from this LogPublisher. |
void |
removedFrom(LogBroadcaster le)
Called when we get removed from a LogPublisher. |
void |
removeLogListener(LogListener ls)
Call to detach a Listener for log events received by the LogBroadcaster. |
void |
setFilter(de.infinityloop.util.log.helpers.LogEventFilter f)
Sets a new LogEventFilter instance for this collector. |
void |
setLevel(int filterLevel)
|
java.lang.String |
toString()
|
void |
unregisterFromAll()
This method unregisters this LogSubscriber from all LogPublishers it is registered with. |
| Methods inherited from class java.util.ArrayList |
|---|
add, add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
|---|
iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Constructor Detail |
|---|
public LogEventCollector(java.lang.String name,
de.infinityloop.util.log.helpers.LogEventFilter f)
name - TODO
public LogEventCollector(java.lang.String name,
LogBroadcaster lb,
de.infinityloop.util.log.helpers.LogEventFilter f)
| Method Detail |
|---|
public de.infinityloop.util.log.helpers.LogEventFilter getFilter()
public void setFilter(de.infinityloop.util.log.helpers.LogEventFilter f)
public boolean equals(java.lang.Object o)
equals in interface java.util.Collection<LogEvent>equals in interface java.util.List<LogEvent>equals in class java.util.AbstractList<LogEvent>o -
AbstractList.equals(java.lang.Object)public int hashCode()
hashCode in interface java.util.Collection<LogEvent>hashCode in interface java.util.List<LogEvent>hashCode in class java.util.AbstractList<LogEvent>AbstractList.hashCode()public boolean receiveLogEvent(LogEvent le)
receiveLogEvent in interface LogListenerle -
LogListener.receiveLogEvent(de.infinityloop.util.log.LogEvent)public java.util.ArrayList getNotifications()
public void clear()
clear in interface java.util.Collection<LogEvent>clear in interface java.util.List<LogEvent>clear in class java.util.ArrayList<LogEvent>public int countType(int type)
type - one of the types
public LogEvent getLogEvent(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i -
java.lang.ArrayIndexOutOfBoundsExceptionpublic java.lang.String getAsString()
public void addedTo(LogBroadcaster le)
addedTo in interface LogListenerle - LogListener.addedTo(de.infinityloop.util.log.LogBroadcaster)public void removedFrom(LogBroadcaster le)
removedFrom in interface LogListenerle - LogListener.removedFrom(de.infinityloop.util.log.LogBroadcaster)public void unregisterFromAll()
public LogEventCollector extractSignificantEntries(int[] types,
int[] including,
int[] excluding)
null, all entries are examined. Otherwise, only those that match any of the
contained types are observed.
including. If
including is null, all entries pass this step.
excluding. If
excluding is null, all entries pass this step.
types - a variable length array of integers containing the type of LogEvent objects you are interested in.
E.g. passing new int[] { LogEvent.ERROR } will only report entries of type ERROR.
If you pass null, all entries are respected.including - Again in form of a variable size integer array, you can specify which error codes are interesting for you. If you pass null,
all error codes are observed.excluding - Same as for including, but lists the error codes you are not interested in.
null!)public LogEventCollector extractSignificantEntries(de.infinityloop.util.log.helpers.LogEventFilter f)
f - the filter
public LogEvent getEntryByCode(int code)
code - the code to look for
public LogEventCollector getEntriesByType(int type)
type - the type of the entries to retrieve
public java.lang.Throwable getEmbeddedException(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - index in list of entries
java.lang.ArrayIndexOutOfBoundsException - when the index is out of bounds
public java.lang.Object[] getParameters(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - index in list of entries
null if none was specified
java.lang.ArrayIndexOutOfBoundsException - when the index is out of bounds
public int getCode(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - index in list of entries
java.lang.ArrayIndexOutOfBoundsException - when the index is out of bounds
public java.lang.String getMessage(int i)
throws java.lang.ArrayIndexOutOfBoundsException
i - index in list of entries
java.lang.ArrayIndexOutOfBoundsException - when the index is out of boundspublic final void setLevel(int filterLevel)
filterLevel - The filterLevel to set.public void addLogListener(LogListener ls)
LogBroadcaster
addLogListener in interface LogBroadcasterls - LogBroadcaster.addLogListener(de.infinityloop.util.log.LogListener)public LogEvent broadcast(LogEvent le)
LogBroadcaster
broadcast in interface LogBroadcasterle -
LogBroadcaster.broadcast(de.infinityloop.util.log.LogEvent)public void removeLogListener(LogListener ls)
LogBroadcaster
removeLogListener in interface LogBroadcasterls - LogBroadcaster.removeLogListener(de.infinityloop.util.log.LogListener)public void removeAllSubscribers()
public java.lang.String toString()
toString in class java.util.AbstractCollection<LogEvent>AbstractCollection.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||