01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.ui.operations;
16:
17: import net.refractions.udig.core.AdapterUtil;
18:
19: /**
20: * Default impl of OpFilter
21: * @author jones
22: * @since 1.1.0
23: */
24: public class AdaptsToFilter implements OpFilter {
25:
26: private String targetClass;
27:
28: /**
29: * @param targetClass Class that the object must resolve to.
30: */
31: public AdaptsToFilter(String targetClass) {
32: this .targetClass = targetClass;
33: }
34:
35: public boolean accept(Object object) {
36: return AdapterUtil.instance.canAdaptTo(targetClass, object);
37: }
38:
39: public boolean canCacheResult() {
40: return true;
41: }
42:
43: public boolean isBlocking() {
44: return false;
45: }
46:
47: public void addListener(IOpFilterListener listener) {
48: // do nothing
49: }
50:
51: public void removeListener(IOpFilterListener listener) {
52: // do nothing
53: }
54:
55: }
|