01: // ResourceShadower.java
02: // $Id: ResourceShadower.java,v 1.2 2000/08/16 21:37:53 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.tools.resources;
07:
08: /**
09: * This interface describe the <em>proxy</em> pattern.
10: * Resource can be proxied: a given resource can act as if it was some other
11: * resource; this interface describe how to access the proxy resource
12: * attributes in such cases.
13: */
14:
15: public interface ResourceShadower {
16:
17: /**
18: * Get the resource shadowed by this object.
19: * @return A Resource instance, or <strong>null</strong>
20: */
21:
22: public Resource getTargetResource();
23:
24: /**
25: * Get the list of attributes shadowed byt htis shadowing resource.
26: * @return The attribute list of the shadowed object.
27: */
28:
29: public Attribute[] getTargetAttributes();
30:
31: /**
32: * Get a shadowed attribute value.
33: * @param idx The index of the shadowed attribute.
34: * @param def The default return value (if no shadow value defined).
35: * @return The shadowed attribute value, of the provided default.
36: */
37:
38: public Object getTargetValue(int idx, Object def);
39:
40: /**
41: * Get a shadowed attribute value (by name).
42: * @param name The name of the shadowed attribute.
43: * @param def The default return value (if no shadow value defined).
44: * @return The shadowed attribute value, of the provided default.
45: */
46:
47: public Object getTargetValue(String name, Object def);
48:
49: /**
50: * Set a shadowed attribute value.
51: * @param idx The index of the attribute to set.
52: * @param value Its new value.
53: */
54:
55: public void setTargetValue(int idx, Object value);
56:
57: /**
58: * Set a shadowed attribute value by name.
59: * @param name The name of the shadowed attribute.
60: * @param value Its new value.
61: */
62:
63: public void setTargetValue(String name, Object def);
64:
65: /**
66: * Does this shadow object defines the given attribute.
67: * @param idx The index of the shadowed attribute to test.
68: */
69:
70: public boolean definesTargetAttribute(int idx);
71:
72: /**
73: * Does this shadow object defines the given attribute (by name).
74: * @param name The name of the target attribute.
75: * @return A boolean <strong>true</strong> if attribute is defined.
76: */
77:
78: public boolean definesTargetAttribute(String name);
79:
80: }
|