KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > exceptions > entity > LinePK


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.exceptions.entity;
20
21 import java.io.Serializable JavaDoc;
22 import javax.persistence.Column;
23 import javax.persistence.Embeddable;
24
25 /**
26  *
27  * @author Jan Horvath
28  */

29 @Embeddable
30 public class LinePK implements Serializable JavaDoc {
31     
32     /** Creates a new instance of LinePK */
33         @Column(name = "STACKTRACE_ID", nullable = false)
34     private int stacktraceId;
35     @Column(name = "METHOD_ID", nullable = false)
36     private int methodId;
37     @Column(name = "LINENUMBER", nullable = false)
38     private int linenumber;
39     @Column(name = "LINE_ORDER", nullable = false)
40     private int lineOrder;
41
42     /** Creates a new instance of LinePK */
43     public LinePK() {
44     }
45     
46     public LinePK(int stacktraceId, int methodId, int linenumber, int lineOrder) {
47         this.stacktraceId = stacktraceId;
48         this.methodId = methodId;
49         this.linenumber = linenumber;
50         this.lineOrder = lineOrder;
51     }
52
53     public int getStacktraceId() {
54         return stacktraceId;
55     }
56
57     public void setStacktraceId(int stacktraceId) {
58         this.stacktraceId = stacktraceId;
59     }
60
61     public int getMethodId() {
62         return methodId;
63     }
64
65     public void setMethodId(int methodId) {
66         this.methodId = methodId;
67     }
68
69     public int getLinenumber() {
70         return linenumber;
71     }
72
73     public void setLinenumber(int linenumber) {
74         this.linenumber = linenumber;
75     }
76
77     public int getLineOrder() {
78         return lineOrder;
79     }
80
81     public void setLineOrder(int lineOrder) {
82         this.lineOrder = lineOrder;
83     }
84
85     @Override JavaDoc
86     public int hashCode() {
87         int hash = 0;
88
89         hash += (int) stacktraceId;
90         hash += (int) methodId;
91         hash += (int) linenumber;
92         hash += (int) lineOrder;
93         return hash;
94     }
95
96     @Override JavaDoc
97     public boolean equals(Object JavaDoc object) {
98         if (!(object instanceof LinePK)) {
99             return false;
100         }
101         LinePK other = (LinePK) object;
102
103         if (this.stacktraceId != other.stacktraceId)
104             return false;
105         if (this.methodId != other.methodId)
106             return false;
107         if (this.linenumber != other.linenumber)
108             return false;
109         if (this.lineOrder != other.lineOrder)
110             return false;
111         return true;
112     }
113
114     @Override JavaDoc
115     public String JavaDoc toString() {
116         return "test.LinePK[stacktraceId=" + stacktraceId + ", methodId=" +
117                methodId + ", linenumber=" + linenumber + ", lineOrder=" +
118                lineOrder + "]";
119     }
120
121 }
122
Popular Tags