Project

General

Profile

Download (1.76 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.io.common.events;
10

    
11
/**
12
 * @author a.mueller
13
 \* @since 24.06.2011
14
 *
15
 */
16
public class IoProblemEvent extends IoEventBase {
17
	
18

    
19
	public static IoProblemEvent NewInstance(Class throwingClass, String message, String location, int lineNumber, int severity, String methodName){
20
		IoProblemEvent result = new IoProblemEvent();
21
		result.setThrowingClass(throwingClass);
22
		result.setMessage(message);
23
		result.setLocation(location);
24
		result.setLineNumber(lineNumber);
25
		result.setSeverity(severity);
26
		result.setMethodName(methodName);
27
		return result;
28
	}
29
	
30
	protected IoProblemEvent(){
31
		super();
32
	}
33
	
34
	private int severity;
35
	private int lineNumber;
36
	private String methodName;
37
	
38
	public void setSeverity(int severity) {
39
		this.severity = severity;
40
	}
41

    
42
	public int getSeverity() {
43
		return severity;
44
	}
45

    
46
	public void setLineNumber(int lineNumber) {
47
		this.lineNumber = lineNumber;
48
	}
49

    
50
	public int getLineNumber() {
51
		return lineNumber;
52
	}
53
	
54
	public void setMethodName(String methodName) {
55
		this.methodName = methodName;
56
	}
57

    
58
	public String getMethodName() {
59
		return methodName;
60
	}
61
	
62

    
63
	/* (non-Javadoc)
64
	 * @see java.lang.Object#toString()
65
	 */
66
	@Override
67
	public String toString() {
68
		String className = getThrowingClass() == null ? "-" : getThrowingClass().getSimpleName();
69
		return String.format("%s [location=%s; severity=%d; %s/%s:%d]",	getMessage(), getLocation(), getSeverity(), className, getMethodName(), getLineNumber());
70
	}
71

    
72
	
73
	
74
}
(4-4/6)