Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LocalReferenceImpl |
|
| 3.4285714285714284;3.429 |
1 | package org.apache.commons.ognl.enhance; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | /** | |
23 | * Implementation of {@link LocalReference}. | |
24 | */ | |
25 | public class LocalReferenceImpl | |
26 | implements LocalReference | |
27 | { | |
28 | ||
29 | private final String name; | |
30 | ||
31 | private final Class<?> type; | |
32 | ||
33 | private final String expression; | |
34 | ||
35 | public LocalReferenceImpl( String name, String expression, Class<?> type ) | |
36 | 149 | { |
37 | 149 | this.name = name; |
38 | 149 | this.type = type; |
39 | 149 | this.expression = expression; |
40 | 149 | } |
41 | ||
42 | /** | |
43 | * {@inheritDoc} | |
44 | */ | |
45 | public String getName() | |
46 | { | |
47 | 146 | return name; |
48 | } | |
49 | ||
50 | /** | |
51 | * {@inheritDoc} | |
52 | */ | |
53 | public String getExpression() | |
54 | { | |
55 | 146 | return expression; |
56 | } | |
57 | ||
58 | /** | |
59 | * {@inheritDoc} | |
60 | */ | |
61 | public Class<?> getType() | |
62 | { | |
63 | 292 | return type; |
64 | } | |
65 | ||
66 | /** | |
67 | * {@inheritDoc} | |
68 | */ | |
69 | @Override | |
70 | public boolean equals( Object o ) | |
71 | { | |
72 | 0 | if ( this == o ) |
73 | { | |
74 | 0 | return true; |
75 | } | |
76 | 0 | if ( o == null || getClass() != o.getClass() ) |
77 | { | |
78 | 0 | return false; |
79 | } | |
80 | ||
81 | 0 | LocalReferenceImpl that = (LocalReferenceImpl) o; |
82 | ||
83 | 0 | if ( expression != null ? !expression.equals( that.expression ) : that.expression != null ) |
84 | { | |
85 | 0 | return false; |
86 | } | |
87 | 0 | if ( name != null ? !name.equals( that.name ) : that.name != null ) |
88 | { | |
89 | 0 | return false; |
90 | } | |
91 | 0 | if ( type != null ? !type.equals( that.type ) : that.type != null ) |
92 | { | |
93 | 0 | return false; |
94 | } | |
95 | ||
96 | 0 | return true; |
97 | } | |
98 | ||
99 | /** | |
100 | * {@inheritDoc} | |
101 | */ | |
102 | @Override | |
103 | public int hashCode() | |
104 | { | |
105 | int result; | |
106 | 0 | result = ( name != null ? name.hashCode() : 0 ); |
107 | 0 | result = 31 * result + ( type != null ? type.hashCode() : 0 ); |
108 | 0 | result = 31 * result + ( expression != null ? expression.hashCode() : 0 ); |
109 | 0 | return result; |
110 | } | |
111 | ||
112 | /** | |
113 | * {@inheritDoc} | |
114 | */ | |
115 | @Override | |
116 | public String toString() | |
117 | { | |
118 | 0 | return "LocalReferenceImpl[" + "_name='" + name + '\'' + '\n' + ", _type=" + type + '\n' + ", _expression='" |
119 | + expression + '\'' + '\n' + ']'; | |
120 | } | |
121 | } |