|
@@ -169,30 +169,11 @@ public class CallbackManager {
|
169
|
169
|
* Add new callback type.
|
170
|
170
|
*
|
171
|
171
|
* @param callback CallbackObject subclass for the callback.
|
172
|
|
- * @return if adding succeeded or not.
|
173
|
172
|
*/
|
174
|
|
- public boolean addCallbackType(final CallbackObject callback) {
|
|
173
|
+ private void addCallbackType(final CallbackObject callback) {
|
175
|
174
|
if (!callbackHash.containsKey(callback.getType())) {
|
176
|
175
|
callbackHash.put(callback.getType(), callback);
|
177
|
|
- return true;
|
178
|
176
|
}
|
179
|
|
-
|
180
|
|
- return false;
|
181
|
|
- }
|
182
|
|
-
|
183
|
|
- /**
|
184
|
|
- * Remove a callback type.
|
185
|
|
- *
|
186
|
|
- * @param callback CallbackObject subclass to remove.
|
187
|
|
- * @return if removal succeeded or not.
|
188
|
|
- */
|
189
|
|
- public boolean delCallbackType(final CallbackObject callback) {
|
190
|
|
- if (callbackHash.containsKey(callback.getType())) {
|
191
|
|
- callbackHash.remove(callback.getType());
|
192
|
|
- return true;
|
193
|
|
- }
|
194
|
|
-
|
195
|
|
- return false;
|
196
|
177
|
}
|
197
|
178
|
|
198
|
179
|
/**
|
|
@@ -275,45 +256,6 @@ public class CallbackManager {
|
275
|
256
|
((CallbackObjectSpecific) getCallbackType(callback)).add(o, target);
|
276
|
257
|
}
|
277
|
258
|
|
278
|
|
- /**
|
279
|
|
- * Add a callback without an exception.
|
280
|
|
- * This should be used if a callback is not essential for execution (ie the DebugOut callback)
|
281
|
|
- *
|
282
|
|
- * @param <S> The type of callback object
|
283
|
|
- * @param callback Type of callback object.
|
284
|
|
- * @param o instance of ICallbackInterface to add.
|
285
|
|
- * @return true/false if the callback was added or not.
|
286
|
|
- */
|
287
|
|
- public <S extends CallbackInterface> boolean addNonCriticalCallback(
|
288
|
|
- final Class<S> callback, final S o) {
|
289
|
|
- try {
|
290
|
|
- addCallback(callback, o);
|
291
|
|
- return true;
|
292
|
|
- } catch (CallbackNotFoundException e) {
|
293
|
|
- return false;
|
294
|
|
- }
|
295
|
|
- }
|
296
|
|
-
|
297
|
|
- /**
|
298
|
|
- * Add a callback with a specific target.
|
299
|
|
- * This should be used if a callback is not essential for execution
|
300
|
|
- *
|
301
|
|
- * @param <S> The type of callback
|
302
|
|
- * @param callback Type of callback object.
|
303
|
|
- * @param o instance of ICallbackInterface to add.
|
304
|
|
- * @param target Parameter to specify that a callback should only fire for specific things
|
305
|
|
- * @return true/false if the callback was added or not.
|
306
|
|
- */
|
307
|
|
- public <S extends CallbackInterface> boolean addNonCriticalCallback(
|
308
|
|
- final Class<S> callback, final S o, final String target) {
|
309
|
|
- try {
|
310
|
|
- addCallback(callback, o, target);
|
311
|
|
- return true;
|
312
|
|
- } catch (CallbackNotFoundException e) {
|
313
|
|
- return false;
|
314
|
|
- }
|
315
|
|
- }
|
316
|
|
-
|
317
|
259
|
/**
|
318
|
260
|
* Remove a callback.
|
319
|
261
|
*
|