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 {
44 this.scoped = scoped;
45 this.provided = provided;
46 this.annotated = annotated;
47 this.className = className;
48 this.interfaceName = interfaceName;
49 }
50
51 @Override
52 public int hashCode()
53 {
54 return hashCode( annotated, className, interfaceName, provided, scoped );
55 }
56
57 @Override
58 public boolean equals( Object obj )
59 {
60 if ( this == obj )
61 {
62 return true;
63 }
64 if ( obj == null || getClass() != obj.getClass() )
65 {
66 return false;
67 }
68 BindingJob other = (BindingJob) obj;
69
70 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 final int prime = 31;
80 int result = 1;
81
82 for ( Object arg : args )
83 {
84 result = prime * result + ( ( arg == null ) ? 0 : arg.hashCode() );
85 }
86
87 return result;
88 }
89
90 @Override
91 public String toString()
92 {
93 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 }