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

public Resource getTargetResource()
Get the resource shadowed by this object.
Returns:
A Resource instance, or null

getTargetAttributes

public Attribute[] getTargetAttributes()
Get the list of attributes shadowed byt htis shadowing resource.
Returns:
The attribute list of the shadowed object.

getTargetValue

public 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

public 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

public 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

public 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

public boolean definesTargetAttribute(int idx)
Does this shadow object defines the given attribute.
Parameters:
idx - The index of the shadowed attribute to test.

definesTargetAttribute

public 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.