Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.tools.resources.upgrade
Class ObjectAttribute

    java.lang.Object
      |
      +--org.w3c.tools.resources.upgrade.Attribute
            |
            +--org.w3c.tools.resources.upgrade.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.

Fields inherited from class org.w3c.tools.resources.upgrade.Attribute
`COMPUTED, DONTSAVE, EDITABLE, flags, MANDATORY, name, type`

Constructor Summary
`ObjectAttribute(java.lang.String name, java.lang.Class cls, java.lang.Object def, java.lang.Integer flags)` Create a new ObjectAttribute instance.
`ObjectAttribute(java.lang.String name, java.lang.String cname, java.lang.Object def, java.lang.Integer 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 org.w3c.tools.resources.upgrade.Attribute
`checkFlag, getDefault, getName, getType, stringify`

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,
                           java.lang.Integer 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,
                           java.lang.Integer 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.
  Overrides:
    checkValue in class Attribute
  Parameters:
    `value` - The value to check.
  Returns:
    A boolean true if value is allowed.

### getPickleLength

    public final int getPickleLength(java.lang.Object value)

  Get the number of bytes required to save that attribute value.
  Overrides:
    getPickleLength in class Attribute
  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.

### pickle

    public void pickle(java.io.DataOutputStream out,
                       java.lang.Object obj)

  The ObjectAttribute values can't be pickled.
  Overrides:
    pickle in class Attribute
  Tags copied from class: Attribute
  Parameters:
    `out` - The DataOutputStream to dump the object to.
    `obj` - The object to pickle.
  Throws:
    java.io.IOException - If some IO error occured while dump the attribute.

### unpickle

    public java.lang.Object unpickle(java.io.DataInputStream in)

  The ObjectAttribute values can't be unpickled.
  Overrides:
    unpickle in class Attribute
  Tags copied from class: Attribute
  Parameters:
    `in` - The DataInputStream to read from.
  Returns:
    The object value.
  Throws:
    java.io.IOException - If some IOError occured while reading the stream.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD