1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jadira.scanner.classpath.types;
17
18 import javassist.bytecode.MethodInfo;
19
20 import org.apache.commons.lang3.builder.EqualsBuilder;
21 import org.apache.commons.lang3.builder.HashCodeBuilder;
22 import org.jadira.scanner.classpath.ClasspathResolver;
23 import org.jadira.scanner.classpath.visitor.IntrospectionVisitor;
24 import org.jadira.scanner.core.exception.ClasspathAccessException;
25
26 public class JStaticInitializer extends JOperation {
27
28 protected JStaticInitializer(MethodInfo methodInfo, JType enclosingType, ClasspathResolver resolver) {
29 super(methodInfo, enclosingType, resolver);
30 }
31
32 public static JStaticInitializer getJStaticInitializer(MethodInfo methodInfo, JType enclosingType, ClasspathResolver resolver) {
33 return new JStaticInitializer(methodInfo, enclosingType, resolver);
34 }
35
36 @Override
37 public void acceptVisitor(IntrospectionVisitor visitor) throws ClasspathAccessException {
38 visitor.visit(this);
39
40 for (JParameter next : getParameters()) {
41 next.acceptVisitor(visitor);
42 }
43 for (JAnnotation<?> next : getAnnotations()) {
44 next.acceptVisitor(visitor);
45 }
46 }
47
48 @Override
49 public boolean equals(Object obj) {
50 if (obj == null) {
51 return false;
52 }
53 if (obj == this) {
54 return true;
55 }
56 if (obj.getClass() != getClass()) {
57 return false;
58 }
59
60 return new EqualsBuilder()
61 .appendSuper(super.equals(obj))
62 .isEquals();
63 }
64
65 @Override
66 public int hashCode() {
67 return new HashCodeBuilder(11, 47).append(super.hashCode())
68 .toHashCode();
69 }
70 }