org.w3c.tools.resources
Class ObjectAttribute
java.lang.Object
|
+--org.w3c.tools.resources.Attribute
|
+--org.w3c.tools.resources.ObjectAttribute
- public class ObjectAttribute
- extends Attribute
A generic Object attribute.
This attribute is usefull for attributes that are:
- Have Object values.
- Need not be saved (have the DONTSAVE bit set).
- See Also:
- Serialized Form
Field Summary |
protected java.lang.Class |
cls
The class for values of this attribute. |
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. |
int |
getPickleLength(java.lang.Object value)
Get the number of bytes required to save that attribute value. |
void |
pickle(java.io.DataOutputStream out,
java.lang.Object obj)
The ObjectAttribute values can't be pickled. |
java.lang.Object |
unpickle(java.io.DataInputStream in)
The ObjectAttribute values can't be unpickled. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
cls
protected java.lang.Class cls
- The class for values of this attribute.
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.
checkValue
public boolean checkValue(java.lang.Object value)
- Check that a value is allowed for this attribute.
- Parameters:
value
- The value to check.- Returns:
- A boolean true if value is allowed.
- Overrides:
- checkValue in class Attribute
getPickleLength
public final int getPickleLength(java.lang.Object value)
- Get the number of bytes required to save that attribute value.
- Parameters:
The
- value about to be pickled.- Returns:
- The number of bytes needed to pickle that value.
- Throws:
- java.lang.RuntimeException - Always throw since ObjectAttribute
can't be pickled.
- Overrides:
- getPickleLength in class Attribute
pickle
public void pickle(java.io.DataOutputStream out,
java.lang.Object obj)
- The ObjectAttribute values can't be pickled.
- Overrides:
- pickle in class Attribute
unpickle
public java.lang.Object unpickle(java.io.DataInputStream in)
- The ObjectAttribute values can't be unpickled.
- Overrides:
- unpickle in class Attribute