KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > armedbear > j > jdb > BreakpointSpecification


1 /*
2  * BreakpointSpecification.java
3  *
4  * Copyright (C) 2002-2003 Peter Graves
5  * $Id: BreakpointSpecification.java,v 1.2 2003/06/03 16:51:07 piso Exp $
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */

21
22 package org.armedbear.j.jdb;
23
24 import org.armedbear.j.FastStringBuffer;
25 import org.armedbear.j.Log;
26 import org.xml.sax.Attributes JavaDoc;
27
28 public final class BreakpointSpecification
29 {
30     private final String JavaDoc className;
31     private final String JavaDoc methodName;
32     private final String JavaDoc fileName;
33     private final int lineNumber;
34
35     public BreakpointSpecification(Attributes JavaDoc attributes)
36     {
37         className = attributes.getValue("className");
38         methodName = attributes.getValue("methodName");
39         fileName = attributes.getValue("fileName");
40         int n = 0;
41         String JavaDoc s = attributes.getValue("lineNumber");
42         if (s != null) {
43             try {
44                 n = Integer.parseInt(s);
45             }
46             catch (NumberFormatException JavaDoc e) {
47                 Log.error(e);
48             }
49         }
50         lineNumber = n;
51     }
52
53     public String JavaDoc getClassName()
54     {
55         return className;
56     }
57
58     public String JavaDoc getMethodName()
59     {
60         return methodName;
61     }
62
63     public String JavaDoc getFileName()
64     {
65         return fileName;
66     }
67
68     public int getLineNumber()
69     {
70         return lineNumber;
71     }
72
73     // Only used to generate meaningful trace output.
74
public String JavaDoc toString()
75     {
76         final String JavaDoc separator = System.getProperty("line.separator");
77         FastStringBuffer sb = new FastStringBuffer("BreakpointSpecification: ");
78         sb.append(separator);
79         sb.append(" className = " + className);
80         sb.append(separator);
81         sb.append(" methodName = " + methodName);
82         sb.append(separator);
83         sb.append(" fileName = " + fileName);
84         sb.append(separator);
85         sb.append(" lineNumber = " + lineNumber);
86         return sb.toString();
87     }
88 }
89
Popular Tags