1 | |
package org.apache.onami.autobind.install.bindjob; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
import static com.google.common.base.Objects.equal; |
21 | |
import static com.google.common.base.Objects.toStringHelper; |
22 | |
|
23 | |
import java.lang.annotation.Annotation; |
24 | |
|
25 | |
import javax.inject.Provider; |
26 | |
|
27 | |
@SuppressWarnings( "rawtypes" ) |
28 | |
public class BindingJob |
29 | |
{ |
30 | |
|
31 | |
public final Class<? extends Annotation> scoped; |
32 | |
|
33 | |
public final Class<? extends Provider> provided; |
34 | |
|
35 | |
public final Annotation annotated; |
36 | |
|
37 | |
public final String className; |
38 | |
|
39 | |
public final String interfaceName; |
40 | |
|
41 | |
public BindingJob( Class<? extends Annotation> scoped, Class<? extends Provider> provided, Annotation annotated, |
42 | |
String className, String interfaceName ) |
43 | 0 | { |
44 | 0 | this.scoped = scoped; |
45 | 0 | this.provided = provided; |
46 | 0 | this.annotated = annotated; |
47 | 0 | this.className = className; |
48 | 0 | this.interfaceName = interfaceName; |
49 | 0 | } |
50 | |
|
51 | |
@Override |
52 | |
public int hashCode() |
53 | |
{ |
54 | 0 | return hashCode( annotated, className, interfaceName, provided, scoped ); |
55 | |
} |
56 | |
|
57 | |
@Override |
58 | |
public boolean equals( Object obj ) |
59 | |
{ |
60 | 0 | if ( this == obj ) |
61 | |
{ |
62 | 0 | return true; |
63 | |
} |
64 | 0 | if ( obj == null || getClass() != obj.getClass() ) |
65 | |
{ |
66 | 0 | return false; |
67 | |
} |
68 | 0 | BindingJob other = (BindingJob) obj; |
69 | |
|
70 | 0 | return equal( annotated, other.annotated ) |
71 | |
&& equal( interfaceName, other.interfaceName ) |
72 | |
&& equal( className, other.className ) |
73 | |
&& equal( provided, other.provided ) |
74 | |
&& equal( scoped, other.scoped ); |
75 | |
} |
76 | |
|
77 | |
protected static int hashCode( Object...args ) |
78 | |
{ |
79 | 0 | final int prime = 31; |
80 | 0 | int result = 1; |
81 | |
|
82 | 0 | for ( Object arg : args ) |
83 | |
{ |
84 | 0 | result = prime * result + ( ( arg == null ) ? 0 : arg.hashCode() ); |
85 | |
} |
86 | |
|
87 | 0 | return result; |
88 | |
} |
89 | |
|
90 | |
@Override |
91 | |
public String toString() |
92 | |
{ |
93 | 0 | return toStringHelper( getClass() ) |
94 | |
.add( "annotated", annotated ) |
95 | |
.add( "className", className ) |
96 | |
.add( "interfaceName", interfaceName ) |
97 | |
.add( "provided", provided ) |
98 | |
.add( "scoped", scoped ) |
99 | |
.toString(); |
100 | |
} |
101 | |
|
102 | |
} |