org.w3c.tools.resources
Class ObjectAttribute

java.lang.Object
  extended by org.w3c.tools.resources.Attribute
      extended by org.w3c.tools.resources.ObjectAttribute
All Implemented Interfaces:
java.io.Serializable

public class ObjectAttribute
extends Attribute

A generic Object attribute. This attribute is usefull for attributes that are:

See Also:
Serialized Form

Field Summary
protected  java.lang.Class cls
          The class for values of this attribute.
 
Fields inherited from class org.w3c.tools.resources.Attribute
COMPUTED, DONTSAVE, EDITABLE, flags, MANDATORY, name, type
 
Constructor Summary
ObjectAttribute(java.lang.String name, java.lang.Class cls, java.lang.Object def, int flags)
          Create a new ObjectAttribute instance.
ObjectAttribute(java.lang.String name, java.lang.String cname, java.lang.Object def, int flags)
          Create a new ObjectAttribute instance.
 
Method Summary
 boolean checkValue(java.lang.Object value)
          Check that a value is allowed for this attribute.
 java.lang.String pickle(java.lang.Object obj)
          Pickle an integer to the given output stream.
 java.lang.String stringify(java.lang.Object value)
           
 java.lang.Object unpickle(java.lang.String value)
          Unpickle an integer from the given input stream.
 
Methods inherited from class org.w3c.tools.resources.Attribute
checkFlag, getDefault, getFlag, getName, getType, setFlag, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cls

protected java.lang.Class cls
The class for values of this attribute.

Constructor Detail

ObjectAttribute

public ObjectAttribute(java.lang.String name,
                       java.lang.Class cls,
                       java.lang.Object def,
                       int flags)
Create a new ObjectAttribute instance.

Parameters:
name - The name of the attribute.
cls - The class for this attribute values.
def - The default value for this attribute.
flags - The attribute flags.

ObjectAttribute

public ObjectAttribute(java.lang.String name,
                       java.lang.String cname,
                       java.lang.Object def,
                       int flags)
Create a new ObjectAttribute instance.

Parameters:
name - The name of the attribute.
cname - The name class for this attribute values.
def - The default value for this attribute.
flags - The attribute flags.
Throws:
java.lang.RuntimeException - If we couldn't resolve the class name.
Method Detail

checkValue

public boolean checkValue(java.lang.Object value)
Check that a value is allowed for this attribute.

Specified by:
checkValue in class Attribute
Parameters:
value - The value to check.
Returns:
A boolean true if value is allowed.

pickle

public java.lang.String pickle(java.lang.Object obj)
Pickle an integer to the given output stream.

Parameters:
obj - The object to pickle.

unpickle

public java.lang.Object unpickle(java.lang.String value)
Unpickle an integer from the given input stream.

Parameters:
value - the string representation of this integer
Returns:
An instance of Integer.

stringify

public java.lang.String stringify(java.lang.Object value)
Specified by:
stringify in class Attribute