org.w3c.tools.resources
Class Attribute

java.lang.Object
  extended by org.w3c.tools.resources.Attribute
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ArrayAttribute, FrameArrayAttribute, ObjectAttribute, SimpleAttribute

public abstract class Attribute
extends java.lang.Object
implements java.io.Serializable

Instances of this class describe an attribute of a resource.

See Also:
Serialized Form

Field Summary
static int COMPUTED
          Flags value - This attribute is computed from the resource state.
static int DONTSAVE
          Flag value - This attribute shouldn't be saved.
static int EDITABLE
          Flag value - This attribute is editable.
protected  int flags
          The associated flags (see the predefined flags).
static int MANDATORY
          Flag value - This attribute is mandatory.
protected  java.lang.String name
          The attribute name.
protected  java.lang.String type
          The attribute's value type, as the name of its class.
 
Constructor Summary
Attribute()
          Empty contructor, (cls.newInstance())
Attribute(java.lang.String name, java.lang.Object def, int flags)
          Private constructore to create a new resource attribute description.
 
Method Summary
 boolean checkFlag(int tst)
          Check some flag on this attribute description.
abstract  boolean checkValue(java.lang.Object value)
          Is the provided object a suitable value for this attribute ? If so, store it into the given store.
 java.lang.Object getDefault()
          Get this attribute default value.
 java.lang.String getFlag()
           
 java.lang.String getName()
          Get this attribute name.
 java.lang.String getType()
          Get this attribute type.
 void setFlag(java.lang.String flag)
           
 void setName(java.lang.String name)
          set the attribute name.
abstract  java.lang.String stringify(java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPUTED

public static final int COMPUTED
Flags value - This attribute is computed from the resource state.

See Also:
Constant Field Values

EDITABLE

public static final int EDITABLE
Flag value - This attribute is editable.

See Also:
Constant Field Values

MANDATORY

public static final int MANDATORY
Flag value - This attribute is mandatory.

See Also:
Constant Field Values

DONTSAVE

public static final int DONTSAVE
Flag value - This attribute shouldn't be saved.

See Also:
Constant Field Values

name

protected java.lang.String name
The attribute name.


type

protected java.lang.String type
The attribute's value type, as the name of its class.


flags

protected int flags
The associated flags (see the predefined flags).

Constructor Detail

Attribute

public Attribute(java.lang.String name,
                 java.lang.Object def,
                 int flags)
Private constructore to create a new resource attribute description.

Parameters:
name - The name of the attribute.
def - Its default value.
flags - Its associated flags.

Attribute

public Attribute()
Empty contructor, (cls.newInstance())

Method Detail

getFlag

public java.lang.String getFlag()

setFlag

public void setFlag(java.lang.String flag)

getName

public java.lang.String getName()
Get this attribute name.

Returns:
A String giving the attribute name.

setName

public void setName(java.lang.String name)
set the attribute name.

Parameters:
name - the attribute name.

getType

public java.lang.String getType()
Get this attribute type.


checkFlag

public boolean checkFlag(int tst)
Check some flag on this attribute description.


getDefault

public java.lang.Object getDefault()
Get this attribute default value.

Returns:
A default value for this attribute (may be null).

checkValue

public abstract boolean checkValue(java.lang.Object value)
Is the provided object a suitable value for this attribute ? If so, store it into the given store.

Parameters:
value - The value to check.
store - The array to store the value to if succeed.
idx - The location in the above array.
Returns:
A boolean true if this object can be used as a value for this attribute.
Throws:
IllegalAttributeAccess - If the provided value doesn't match the expected type.

stringify

public abstract java.lang.String stringify(java.lang.Object value)