E
- the type error codes are mapped topublic class ErrorMapper<E>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
ErrorMapper.Visitor
small inner class that implements the visitor interface for the patterns
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
accessPatterns
the patterns to investigate for a certain access code
|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
applicationPatterns
the patterns to investigate for a certain application code
|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
classPatterns
the patterns to investigate for a certain error class code
|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
codePatterns
the patterns to investigate for a certain code
|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
componentPatterns
the patterns to investigate for a certain component code
|
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> |
errorPatterns
the patterns to investigate for a certain error code
|
private java.util.List<ErrorPattern> |
genericPatterns
list of pattern that need to be tested in any case
|
private java.util.Map<ErrorPattern,E> |
patternMap
the mapping from the pattern to the user object
|
private ErrorMapper.Visitor |
visitor
our visitor for adding new patterns
|
Constructor and Description |
---|
ErrorMapper()
constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(ErrorPattern pattern,
E obj)
add a new pattern to the mapper.
|
static java.util.List<ResultMessage> |
filter(java.lang.Iterable<ResultMessage> msgs,
ErrorPattern... patterns)
filter the given result messages that match one of the given patterns
|
boolean |
findMatches(ErrorCode ec,
java.util.Collection<E> result)
test the given error code and add all objects whose related pattern
matches to the given collection
|
void |
findMatches(java.lang.Iterable<ResultMessage> msgs,
java.util.Collection<E> result)
test the given result messages and add all objects whose related pattern
matches to the given list of messages
|
void |
findMatches(Response resp,
java.util.Collection<E> result)
test the given response and add all objects whose related pattern
matches any result message of the response
|
boolean |
findMatches(ResultMessage msg,
java.util.Collection<E> result)
test the given result message and add all objects whose related pattern
matches to the given collection
|
private boolean |
testList(java.util.List<ErrorPattern> list,
ErrorCode ec,
java.util.Collection<E> result)
test all patterns in the given list for a match.
|
private java.util.Map<ErrorPattern,E> patternMap
private java.util.List<ErrorPattern> genericPatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> codePatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> classPatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> accessPatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> applicationPatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> componentPatterns
private java.util.Map<java.lang.String,java.util.List<ErrorPattern>> errorPatterns
private ErrorMapper.Visitor visitor
public void add(ErrorPattern pattern, E obj)
pattern
- the patternobj
- the user objectprivate boolean testList(java.util.List<ErrorPattern> list, ErrorCode ec, java.util.Collection<E> result)
list
- the list, may be null
ec
- the error code to matchresult
- the collection, to which the found elements
are addedtrue
if at least one match
has been foundpublic boolean findMatches(ErrorCode ec, java.util.Collection<E> result)
ec
- the error coderesult
- the collection, to which the found elements
are addedtrue
if at least one match
has been foundpublic boolean findMatches(ResultMessage msg, java.util.Collection<E> result)
msg
- the result messageresult
- the collection, to which the found elements
are addedtrue
if at least one match
has been foundpublic void findMatches(java.lang.Iterable<ResultMessage> msgs, java.util.Collection<E> result)
msgs
- the result messagesresult
- the collection, to which the found elements
are addedpublic void findMatches(Response resp, java.util.Collection<E> result)
resp
- the responseresult
- the collection, to which the found elements
are addedpublic static java.util.List<ResultMessage> filter(java.lang.Iterable<ResultMessage> msgs, ErrorPattern... patterns)
msgs
- the messagespatterns
- the patternsCopyright © 2005-2013 Knipp Medien und Kommunikation GmbH