blob: df06ee77300aec9bcd08ec22b4830fa7e0012329 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.AbortException;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class DefaultMessageHandler implements IMessageHandler {
boolean isVerbose = false;
boolean isDebug = false;
boolean showWeaveInfo = false;
boolean showWarn = true;
public boolean handleMessage(IMessage message) throws AbortException {
if (isIgnoring(message.getKind())) {
return false;
} else {
if (message.getKind().isSameOrLessThan(IMessage.INFO)) {
return SYSTEM_OUT.handleMessage(message);
} else {
return SYSTEM_ERR.handleMessage(message);
}
}
}
public boolean isIgnoring(IMessage.Kind kind) {
if (kind.equals(IMessage.WEAVEINFO)) {
return !showWeaveInfo;
}
if (kind.isSameOrLessThan(IMessage.INFO)) {
return !isVerbose;
}
if (kind.isSameOrLessThan(IMessage.DEBUG)) {
return !isDebug;
}
return !showWarn;
}
public void dontIgnore(IMessage.Kind kind) {
if (kind.equals(IMessage.WEAVEINFO)) {
showWeaveInfo = true;
} else if (kind.equals(IMessage.DEBUG)) {
isVerbose = true;
} else if (kind.equals(IMessage.WARNING)) {
showWarn = false;
}
}
public void ignore(IMessage.Kind kind) {
if (kind.equals(IMessage.WEAVEINFO)) {
showWeaveInfo = false;
} else if (kind.equals(IMessage.DEBUG)) {
isVerbose = false;
} else if (kind.equals(IMessage.WARNING)) {
showWarn = true;
}
}
}
|