01: /*
02: * Copyright (C) Chaperon. All rights reserved.
03: * -------------------------------------------------------------------------
04: * This software is published under the terms of the Apache Software License
05: * version 1.1, a copy of which has been included with this distribution in
06: * the LICENSE file.
07: */
08:
09: package net.sourceforge.chaperon.model;
10:
11: /**
12: * This class represents a violation, which occurs during during the validation of the model.
13: *
14: * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
15: * @version CVS $Id: Violation.java,v 1.3 2003/12/09 19:55:52 benedikta Exp $
16: */
17: public class Violation {
18: private String message;
19: private String location = "unknown";
20:
21: /**
22: * Create a new violation.
23: *
24: * @param message Message of the violation.
25: * @param location Location of the part from the model.
26: */
27: public Violation(String message, String location) {
28: this .message = message;
29: if (location != null)
30: this .location = location;
31: }
32:
33: /**
34: * Return the message of the violation.
35: *
36: * @return Message of the violation.
37: */
38: public String getMessage() {
39: return message;
40: }
41:
42: /**
43: * The location of the part from the model.
44: *
45: * @return location of the part from the model.
46: */
47: public String getLocation() {
48: return location;
49: }
50:
51: /**
52: * Return the string representation of the violation
53: *
54: * @return String representation.
55: */
56: public String toString() {
57: return message + "[" + location + "]";
58: }
59: }
|