//==============================================================================
// WritableProperty.java
//==============================================================================
package tribble.archive;
import java.lang.Exception;
import java.lang.Object;
import java.lang.String;
/*******************************************************************************
* Generic modifiable document property.
*
*
* This class provides the fundamental attributes and methods for a
* document property associated with a modifiable archive document.
*
*
* An archive document is composed of content data (such as an image,
* text, or other kind of user data) and one or more properties.
* Typically, the properties comprise the indices used to store the document in
* a document storage system. All of the documents within an archive system
* typically share the same set of document properties, although this is not
* required of any implementation.
*
*
* Each document property has the following attributes:
*
* - name
*
- type
*
- length
*
- input (source) format
*
- output (archive) format
*
- default value
*
*
* There may be other attributes of the properties, which are specific to the
* particular subclass implementation of the archive system.
*
*
* A given property that is associated with a particular archive document also
* has a value, which is an object of some sort.
* For documents being written to an archive by an {@link ArchiveWriter},
* a property can be associated with the document using the
* {@link WritableDocument#addProperty WritableDocument.addProperty()}
* method (or by some other means provided by the implementation).
* Once the property is associated with the document, its value can be set to
* some object using the
* {@link WritableDocument#setProperty WritableDocument.setProperty()} method.
*
*
* The value of a property is the minimum amount of information that is
* useful to an implementation. The other attributes may be used or ignored by
* the implementation as it deems necessary.
*
*
* Note: This requires Java 1.5 or later.
*
*
*
* - Source code:
* -
* http://david.tribble.com/src/java/tribble/archive/WritableProperty.java
*
* - Documentation:
* -
* http://david.tribble.com/docs/tribble/archive/WritableProperty.html
*
*
*
*
* @version API 2.0, $Revision: 1.1 $ $Date: 2008/04/03 22:10:34 $
* @since 2008-04-03
* @author David R. Tribble (david@tribble.com)
* Copyright ©2004 by David R. Tribble, all rights reserved.
*
* @see WritableDocument
* @see ArchiveWriter
*/
public class WritableProperty
extends DocumentProperty
{
static final String REV =
"@(#)tribble/archive/WritableProperty.java $Revision: 1.1 $ $Date: 2008/04/03 22:10:34 $\n";
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
// Constructors
/**************************************************************************
* Constructor.
*
* @param name
* The name of this document property.
*
* @since API 2.0, 2008-04-03
*/
public WritableProperty(String name)
{
super(name);
}
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
// Methods
/***************************************************************************
* Establish the name of this document property.
*
* @param name
* The name of this property.
*
* @since API 2.0, 2008-04-03
*/
public void setName(String name)
{
m_name = name;
}
/***************************************************************************
* Establish the type of this document property.
*
* @param type
* The type of this property, which is one of the
* {@link #TYPE_TEXT TYPE_XXX} constants or some other
* application-defined value, or null if it is not defined.
*
* @since API 2.0, 2008-04-03
*/
public void setType(String type)
{
m_type = type;
}
/***************************************************************************
* Establish the length of this document property.
*
* @param len
* The length of this document property, or zero if it is not defined.
*
* @since API 2.0, 2008-04-03
*/
public void setLength(int len)
{
m_len = len;
}
/***************************************************************************
* Establish the output format specification for this document property.
*
* @param fmt
* The formatting specification of this property, which specifies how the
* property value should be formatted when it is stored in an archive
* document; or null if it is not defined.
*
* @since API 2.0, 2008-04-03
*/
public void setOutputFormat(String fmt)
{
m_outFmt = fmt;
}
/***************************************************************************
* Establish the input (source) format specification for this document
* property.
*
* @param fmt
* The source formatting specification of this property, which specifies the
* format of the property value before it is stored in an archive document
* (i.e., it specifies how the source value for this property should be
* unformatted when its value is set, prior to being
* reformatted when it is written to the archive);
* or null if it is not defined.
*
* @since API 2.0, 2008-04-03
*/
public void setInputFormat(String fmt)
{
m_inFmt = fmt;
}
/***************************************************************************
* Establish the default value for this document property.
*
* @param val
* The default value to be used by this document property if it is not
* explicitly set to another value. This can be null.
*
* @since API 2.0, 2008-04-03
*/
public void setDefaultValue(Object val)
{
m_dflVal = val;
}
}
// End WritableProperty.java