KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > chaperon > model > Violation


1 /*
2  * Copyright (C) Chaperon. All rights reserved.
3  * -------------------------------------------------------------------------
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE file.
7  */

8
9 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 {
19   private String JavaDoc message;
20   private String JavaDoc location = "unknown";
21
22   /**
23    * Create a new violation.
24    *
25    * @param message Message of the violation.
26    * @param location Location of the part from the model.
27    */

28   public Violation(String JavaDoc message, String JavaDoc location)
29   {
30     this.message = message;
31     if (location!=null)
32       this.location = location;
33   }
34
35   /**
36    * Return the message of the violation.
37    *
38    * @return Message of the violation.
39    */

40   public String JavaDoc getMessage()
41   {
42     return message;
43   }
44
45   /**
46    * The location of the part from the model.
47    *
48    * @return location of the part from the model.
49    */

50   public String JavaDoc getLocation()
51   {
52     return location;
53   }
54
55   /**
56    * Return the string representation of the violation
57    *
58    * @return String representation.
59    */

60   public String JavaDoc toString()
61   {
62     return message+"["+location+"]";
63   }
64 }
65
Popular Tags