%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.aspects.hibernate.HibernateQueryContext |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | * |
|
16 | * |
|
17 | * |
|
18 | * Original Author: binil.thomas (Tavant Technologies) |
|
19 | * Contributor(s): -; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.aspects.hibernate; |
|
23 | ||
24 | import net.sf.infrared.aspects.AbstractExecutionContext; |
|
25 | ||
26 | /** |
|
27 | * |
|
28 | * @author binil.thomas |
|
29 | */ |
|
30 | public class HibernateQueryContext extends AbstractExecutionContext { |
|
31 | private String query; |
|
32 | ||
33 | public HibernateQueryContext(String query) { |
|
34 | 0 | super("Hibernate"); |
35 | 0 | if (query == null) { |
36 | 0 | throw new IllegalArgumentException("query string cannot be null"); |
37 | } |
|
38 | 0 | this.query = query; |
39 | 0 | } |
40 | ||
41 | public HibernateQueryContext(String name, String layer) { |
|
42 | 0 | super(layer); |
43 | 0 | this.query = name; |
44 | 0 | } |
45 | ||
46 | public String getName() { |
|
47 | 0 | return this.query; |
48 | } |
|
49 | ||
50 | public String toString() { |
|
51 | 0 | return "Hibernate Query " + this.query; |
52 | } |
|
53 | ||
54 | public boolean equals(Object o) { |
|
55 | 0 | if (o == null) { |
56 | 0 | return false; |
57 | } |
|
58 | ||
59 | 0 | if (o == this) { |
60 | 0 | return true; |
61 | } |
|
62 | ||
63 | 0 | if (! (o instanceof HibernateQueryContext) ) { |
64 | 0 | return false; |
65 | } |
|
66 | ||
67 | 0 | HibernateQueryContext other = (HibernateQueryContext) o; |
68 | ||
69 | 0 | return other.query.equals( this.query ); |
70 | } |
|
71 | ||
72 | public int hashCode() { |
|
73 | 0 | return 7 * query.hashCode(); |
74 | } |
|
75 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |