1 package org.apache.torque.generator.java;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.apache.torque.generator.GeneratorException;
25 import org.apache.torque.generator.control.ControllerState;
26 import org.apache.torque.generator.outlet.OutletImpl;
27 import org.apache.torque.generator.outlet.OutletResult;
28 import org.apache.torque.generator.qname.QualifiedName;
29
30
31
32 public class JavaOutlet extends OutletImpl
33 {
34
35 private static Log log = LogFactory.getLog(JavaOutlet.class);
36
37
38 private String foo;
39
40
41 private String bar;
42
43 public JavaOutlet(QualifiedName name)
44 {
45 super(name);
46 }
47
48 @Override
49 public OutletResult execute(ControllerState controllerState)
50 throws GeneratorException
51 {
52 return new OutletResult(
53 "Test Outlet output; foo=" + foo + "; bar=" + bar);
54 }
55
56 public void setFoo(String foo)
57 {
58 log.info("foo set to " + foo);
59 this.foo = foo;
60 }
61
62 public void setBar(String bar)
63 {
64 log.info("bar set to " + bar);
65 this.bar = bar;
66 }
67
68 public String getBar()
69 {
70 return bar;
71 }
72
73 public String getFoo()
74 {
75 return foo;
76 }
77
78 @Override
79 public int hashCode()
80 {
81 final int prime = 31;
82 int result = 1;
83 result = prime * result + ((bar == null) ? 0 : bar.hashCode());
84 result = prime * result + ((foo == null) ? 0 : foo.hashCode());
85 result = prime * result + getName().hashCode();
86 result = prime * result + ((getInputElementName() == null)
87 ? 0
88 : getInputElementName().hashCode());
89 return result;
90 }
91
92 @Override
93 public boolean equals(Object obj)
94 {
95 if (this == obj)
96 {
97 return true;
98 }
99 if (obj == null)
100 {
101 return false;
102 }
103 if (getClass() != obj.getClass())
104 {
105 return false;
106 }
107 JavaOutlet other = (JavaOutlet) obj;
108 if (bar == null)
109 {
110 if (other.bar != null)
111 {
112 return false;
113 }
114 }
115 else if (!bar.equals(other.bar))
116 {
117 return false;
118 }
119 if (foo == null)
120 {
121 if (other.foo != null)
122 {
123 return false;
124 }
125 }
126 else if (!foo.equals(other.foo))
127 {
128 return false;
129 }
130 if (!getName().equals(other.getName()))
131 {
132 return false;
133 }
134 if (getInputElementName() == null)
135 {
136 if (other.getInputElementName() != null)
137 {
138 return false;
139 }
140 }
141 else if (!getInputElementName().equals(other.getInputElementName()))
142 {
143 return false;
144 }
145 return true;
146 }
147 }