org.w3c.tools.resources
Interface ResourceShadower


public interface ResourceShadower

This interface describe the proxy pattern. Resource can be proxied: a given resource can act as if it was some other resource; this interface describe how to access the proxy resource attributes in such cases.


Method Summary
 boolean definesTargetAttribute(int idx)
          Does this shadow object defines the given attribute.
 boolean definesTargetAttribute(java.lang.String name)
          Does this shadow object defines the given attribute (by name).
 Attribute[] getTargetAttributes()
          Get the list of attributes shadowed byt htis shadowing resource.
 Resource getTargetResource()
          Get the resource shadowed by this object.
 java.lang.Object getTargetValue(int idx, java.lang.Object def)
          Get a shadowed attribute value.
 java.lang.Object getTargetValue(java.lang.String name, java.lang.Object def)
          Get a shadowed attribute value (by name).
 void setTargetValue(int idx, java.lang.Object value)
          Set a shadowed attribute value.
 void setTargetValue(java.lang.String name, java.lang.Object def)
          Set a shadowed attribute value by name.
 

Method Detail

getTargetResource

Resource getTargetResource()
Get the resource shadowed by this object.

Returns:
A Resource instance, or null

getTargetAttributes

Attribute[] getTargetAttributes()
Get the list of attributes shadowed byt htis shadowing resource.

Returns:
The attribute list of the shadowed object.

getTargetValue

java.lang.Object getTargetValue(int idx,
                                java.lang.Object def)
Get a shadowed attribute value.

Parameters:
idx - The index of the shadowed attribute.
def - The default return value (if no shadow value defined).
Returns:
The shadowed attribute value, of the provided default.

getTargetValue

java.lang.Object getTargetValue(java.lang.String name,
                                java.lang.Object def)
Get a shadowed attribute value (by name).

Parameters:
name - The name of the shadowed attribute.
def - The default return value (if no shadow value defined).
Returns:
The shadowed attribute value, of the provided default.

setTargetValue

void setTargetValue(int idx,
                    java.lang.Object value)
Set a shadowed attribute value.

Parameters:
idx - The index of the attribute to set.
value - Its new value.

setTargetValue

void setTargetValue(java.lang.String name,
                    java.lang.Object def)
Set a shadowed attribute value by name.

Parameters:
name - The name of the shadowed attribute.
value - Its new value.

definesTargetAttribute

boolean definesTargetAttribute(int idx)
Does this shadow object defines the given attribute.

Parameters:
idx - The index of the shadowed attribute to test.

definesTargetAttribute

boolean definesTargetAttribute(java.lang.String name)
Does this shadow object defines the given attribute (by name).

Parameters:
name - The name of the target attribute.
Returns:
A boolean true if attribute is defined.