01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.core;
18:
19: import java.io.IOException;
20:
21: import org.eclipse.core.runtime.IProgressMonitor;
22:
23: /**
24: * Objects that implement this interface can adapt to other objects but require that it be done is a
25: * separate job because the adaptation may be blocking.
26: *
27: * @see org.eclipse.core.runtime.IAdaptable
28: * @author jeichar
29: */
30: public interface IBlockingAdaptable {
31: /**
32: * The class will attempt to adapt into an object of the adapter class. This method may be
33: * blocking.
34: *
35: * @param adapter The class that the object will attempt to change into.
36: * @param monitor A monitor to track the progress of the adaptation.
37: * @return an object of type T or null if the adaptation is not possible.
38: * @throws IOException may throw an IOException if the adaptation fails.
39: */
40: public <T> T getAdapter(Class<T> adapter, IProgressMonitor monitor)
41: throws IOException;
42:
43: /**
44: * Returns true if this class can adapt to an object of type <code>Class<T></code>
45: * <p>
46: * It does not guarantee that the object can adapt, just that it believes it can
47: * </p>
48: *
49: * @param adapter the adapter to adapt to.
50: * @return true if the object believes that it can adapt to an object class T.
51: */
52: public <T> boolean canAdaptTo(Class<T> adapter);
53: }
|