01: package net.refractions.udig.project;
02:
03: import org.eclipse.core.runtime.IExtension;
04:
05: /**
06: * Provides an object of type T. Used to populate the IBlackboard with default values.
07: * <p>This is used by the <em>net.refractions.udig.project.provider</em> extension point</p>
08: *
09: * @author Jesse
10: * @since 1.0.0
11: */
12: public abstract class IProvider<T> {
13:
14: /** Extension point id. * */
15: public static final String XPID = "net.refractions.udig.project.provider"; //$NON-NLS-1$
16:
17: /** the extension configuration element * */
18: IExtension extension;
19:
20: /** key used to identify provider * */
21: String key;
22:
23: /**
24: * Sets the extension that provier originated from. This method should not be called by client
25: * code.
26: *
27: * @param extension The extension in which the provider was instantiated.
28: * @uml.property name="extension"
29: */
30: public void setExtension(IExtension extension) {
31: this .extension = extension;
32: }
33:
34: /**
35: * @return the extension the provider originated from.
36: * @uml.property name="extension"
37: */
38: public IExtension getExtension() {
39: return extension;
40: }
41:
42: /**
43: * @return the key that is used to identify the object being provided.
44: * @uml.property name="key"
45: */
46: public String getKey() {
47: return key;
48: }
49:
50: /**
51: * @param key the key that is used to identify the object being provided.
52: * @uml.property name="key"
53: */
54: public void setKey(String key) {
55: this .key = key;
56: }
57:
58: /**
59: * Returns the class of the object being provided. How this class relates to the class of
60: * objects being provided (via inheritance) is up to the client of the provider.
61: *
62: * @return The type of the object being provider (the providee).
63: */
64: public abstract Class<T> getProvidee();
65:
66: /**
67: * Signals the provider to provide an object of the specified class. If the object can not be
68: * provided.
69: *
70: * @return The object being provided, otherwise null.
71: */
72: public abstract T provide();
73:
74: }
|