All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class w3c.tools.store.Attribute
java.lang.Object
   |
   +----w3c.tools.store.Attribute
  -  public abstract class Attribute
  -  extends Object
  -  implements Serializable
Instances of this class describe an attribute of a resource.
   
  -   COMPUTED COMPUTED
-   Flags value - This attribute is computed from the resource state.
  
-   DONTSAVE DONTSAVE
-   Flag value - This attribute shouldn't be saved.
  
-   EDITABLE EDITABLE
-   Flag value - This attribute is editable.
  
-   flags flags
-   The associated flags (see the predefined flags).
  
-   MANDATORY MANDATORY
-   Flag value - This attribute is mandatory.
  
-   name name
-   The attribute name.
  
-   type type
-   The attribute's value type, as the name of its class.
   
  -   Attribute(String, Object, int) Attribute(String, Object, int)
-   Private constructore to create a new resource attribute description.
   
  -   checkFlag(int) checkFlag(int)
-   Check some flag on this attribute description.
  
-   checkValue(Object) checkValue(Object)
-   Is the provided object a suitable value for this attribute ?
 If so, store it into the given store.
  
-   getDefault() getDefault()
-   Get this attribute default value.
  
-   getName() getName()
-   Get this attribute name.
  
-   getPickleLength(Object) getPickleLength(Object)
-   Get number of bytes needed to pickle that attribute.
  
-   getType() getType()
-   Get this attribute type.
  
-   pickle(DataOutputStream, Object) pickle(DataOutputStream, Object)
-   Pickle an attribute of this type to the given stream.
  
-   stringify(Object) stringify(Object)
-   Stringify a value of this kind.
  
-   unpickle(DataInputStream) unpickle(DataInputStream)
-   Unpickle an attribute of this type from the given stream.
   
 COMPUTED
COMPUTED
 public static final int COMPUTED
  -  Flags value - This attribute is computed from the resource state.
 
 EDITABLE
EDITABLE
 public static final int EDITABLE
  -  Flag value - This attribute is editable.
 
 MANDATORY
MANDATORY
 public static final int MANDATORY
  -  Flag value - This attribute is mandatory.
 
 DONTSAVE
DONTSAVE
 public static final int DONTSAVE
  -  Flag value - This attribute shouldn't be saved.
 
 name
name
 protected String name
  -  The attribute name.
 
 type
type
 protected String type
  -  The attribute's value type, as the name of its class.
 
 flags
flags
 protected int flags
  -  The associated flags (see the predefined flags).
 
   
 Attribute
Attribute
 public Attribute(String name,
                  Object def,
                  int flags)
  -  Private constructore to create a new resource attribute description.
   
- 
    -  Parameters:
    
-  name - The name of the attribute.
    -  type - Its type (as a Java class).
    -  def - Its default value.
    -  flags - Its associated flags.
  
 
   
 getName
getName
 public String getName()
  -  Get this attribute name.
   
- 
    -  Returns:
    
-  A String giving the attribute name.
  
 
 getType
getType
 public String getType()
  -  Get this attribute type.
 
 checkFlag
checkFlag
 public boolean checkFlag(int tst)
  -  Check some flag on this attribute description.
 
 getDefault
getDefault
 public Object getDefault()
  -  Get this attribute default value.
   
- 
    -  Returns:
    
-  A default value for this attribute (may be
    null).
  
 
 stringify
stringify
 public String stringify(Object value)
  -  Stringify a value of this kind.
   
- 
    -  Parameters:
    
-  obj - The value to stringify.
  
 
 checkValue
checkValue
 public abstract boolean checkValue(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.
  
 
 getPickleLength
getPickleLength
 public abstract int getPickleLength(Object value)
  -  Get number of bytes needed to pickle that attribute.
 This method is always called before pickling an attribute, to
 get the length of that attribute value, and record it before saving
 the actual bytes. This allows, for example, to skip attribute whose
 definition was removed from a class. 
 In an ASCII format, this plays a role similar to emitting
 a newline.
 
   
- 
    -  Parameters:
    
-  value - The value that is about to be pickled.
    
-  Returns:
    
-  The number of bytes needed to pickle that value.
  
 
 pickle
pickle
 public abstract void pickle(DataOutputStream out,
                             Object obj) throws IOException
  -  Pickle an attribute of this type to the given stream.
 This method is used to make attribute values persistent, the pickle
 method should dump the provided value in whatever format, provided
 its unpickle method is able to restore it.
   
- 
    -  Parameters:
    
-  out - The DataOutputStream to dump the object to.
    -  obj - The object to pickle.
    
-  Throws: IOException
    
-  If some IO error occured while dump the
    attribute.
  
 
 unpickle
unpickle
 public abstract Object unpickle(DataInputStream in) throws IOException
  -  Unpickle an attribute of this type from the given stream.
 This method is used to restore a pickled attribute value from the given
 stream. It should read in the format it used at pickle time, and
 consume the same number of bytes from the stream.
   
- 
    -  Parameters:
    
-  in - The DataInputStream to read from.
    
-  Returns:
    
-  The object value.
    
-  Throws: IOException
    
-  If some IOError occured while reading the stream.
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index