org.basex.build.fs.parser
Class Metadata

java.lang.Object
  extended by org.basex.build.fs.parser.Metadata

public final class Metadata
extends java.lang.Object

Metadata key-value pairs.

Author:
Workgroup DBIS, University of Konstanz 2005-09, ISC License, Bastian Lemke

Nested Class Summary
static class Metadata.DateField
          Available metadata fields with data type date.
static class Metadata.DateType
          Available xml data types for Metadata.DateField instances.
static class Metadata.IntField
          Available metadata fields with data type integer.
static class Metadata.MetaType
          Available metadata types.
static class Metadata.MimeType
          Available MIME types.
static class Metadata.StringField
          Available metadata fields with data type string.
static class Metadata.XmlSpace
          Enum for valid xml:space attribute values.
 
Field Summary
static byte[] DATA_TYPE
          XML data type attribute name.
static byte[] DATA_TYPE_DURATION
          Duration metadata xml data type.
static byte[] DATA_TYPE_INTEGER
          Integer data type.
static byte[] DATA_TYPE_LONG
          Long data type.
static byte[] DATA_TYPE_SHORT
          Short data type.
static byte[] DATA_TYPE_STRING
          String data type.
static byte[] DURATION
          Duration metadata key.
static byte[] FORMAT
          Metadata format element.
static byte[] TYPE
          Metadata type element.
static byte[] XML_BASE
          xml:base attribute.
static byte[] XML_ID
          xml:id attribute.
static byte[] XML_LANG
          xml:lang attribute.
static byte[] XML_SPACE
          xml:space attribute.
 
Constructor Summary
Metadata()
          Standard constructor.
 
Method Summary
 Atts getAtts()
          Returns all attributes for this metadata item.
 byte[] getDataType()
          Returns the xml data type of the metadata object (e.g. xs:string) as byte array.
 byte[] getKey()
          Returns the key.
 byte[] getValue()
          Returns the value.
 Metadata setDate(Metadata.DateField f, javax.xml.datatype.XMLGregorianCalendar gcal)
          Re-initializes the metadata object as date item.
 Metadata setDuration(javax.xml.datatype.Duration duration)
          Re-initializes the metadata object as duration item.
 Metadata setInt(Metadata.IntField field, byte[] val)
          Re-initializes the metadata object as integer item.
 Metadata setInt(Metadata.IntField field, int val)
          Re-initializes the metadata object as integer item.
 Metadata setLong(Metadata.IntField field, byte[] val)
          Re-initializes the metadata object as long item.
 Metadata setLong(Metadata.IntField field, long val)
          Re-initializes the metadata object as long item.
 Metadata setShort(Metadata.IntField field, byte[] val)
          Re-initializes the metadata object as short item.
 Metadata setShort(Metadata.IntField field, short val)
          Re-initializes the metadata object as short item.
 Metadata setString(Metadata.StringField field, byte[] val)
          Re-initializes the metadata object as string item.
 Metadata setString(Metadata.StringField field, byte[] val, boolean trim)
          Re-initializes the metadata object as string item.
 Metadata setString(Metadata.StringField field, java.lang.String val)
          Re-initializes the metadata object as string item.
 Metadata setString(Metadata.StringField field, java.lang.String val, boolean trim)
          Re-initializes the metadata object as string item.
 void setXmlBase(byte[] base)
          Adds a xml:base attribute.
 void setXmlBase(java.lang.String base)
          Adds a xml:base attribute.
 void setXmlId(byte[] id)
          Adds a xml:id attribute.
 void setXmlId(java.lang.String id)
          Adds a xml:id attribute.
 void setXmlLang(byte[] lang)
          Adds a xml:lang attribute.
 void setXmlLang(java.lang.String lang)
          Adds a xml:lang attribute.
 void setXmlSpace(Metadata.XmlSpace space)
          Adds a xml:space attribute.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_LANG

public static final byte[] XML_LANG
xml:lang attribute.


XML_SPACE

public static final byte[] XML_SPACE
xml:space attribute.


XML_BASE

public static final byte[] XML_BASE
xml:base attribute.


XML_ID

public static final byte[] XML_ID
xml:id attribute.


DATA_TYPE

public static final byte[] DATA_TYPE
XML data type attribute name.


DATA_TYPE_STRING

public static final byte[] DATA_TYPE_STRING
String data type.


DATA_TYPE_SHORT

public static final byte[] DATA_TYPE_SHORT
Short data type.


DATA_TYPE_INTEGER

public static final byte[] DATA_TYPE_INTEGER
Integer data type.


DATA_TYPE_LONG

public static final byte[] DATA_TYPE_LONG
Long data type.


DATA_TYPE_DURATION

public static final byte[] DATA_TYPE_DURATION
Duration metadata xml data type.


TYPE

public static final byte[] TYPE
Metadata type element.


FORMAT

public static final byte[] FORMAT
Metadata format element.


DURATION

public static final byte[] DURATION
Duration metadata key.

Constructor Detail

Metadata

public Metadata()
Standard constructor.

Method Detail

getValue

public byte[] getValue()
Returns the value.

Returns:
the value.

getKey

public byte[] getKey()
Returns the key.

Returns:
the key.

getDataType

public byte[] getDataType()
Returns the xml data type of the metadata object (e.g. xs:string) as byte array.

Returns:
the xml data type.

setXmlLang

public void setXmlLang(java.lang.String lang)
Adds a xml:lang attribute.

Parameters:
lang - the attribute value.

setXmlLang

public void setXmlLang(byte[] lang)
Adds a xml:lang attribute.

Parameters:
lang - the attribute value.

setXmlSpace

public void setXmlSpace(Metadata.XmlSpace space)
Adds a xml:space attribute.

Parameters:
space - the attribute value.

setXmlBase

public void setXmlBase(java.lang.String base)
Adds a xml:base attribute.

Parameters:
base - the attribute value.

setXmlBase

public void setXmlBase(byte[] base)
Adds a xml:base attribute.

Parameters:
base - the attribute value.

setXmlId

public void setXmlId(java.lang.String id)
Adds a xml:id attribute.

Parameters:
id - the attribute value.

setXmlId

public void setXmlId(byte[] id)
Adds a xml:id attribute.

Parameters:
id - the attribute value.

getAtts

public Atts getAtts()
Returns all attributes for this metadata item.

Returns:
all attributes.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setString

public Metadata setString(Metadata.StringField field,
                          byte[] val,
                          boolean trim)
Re-initializes the metadata object as string item.

Parameters:
field - the metadata key.
val - the metadata value.
trim - if true, all leading and trailing whitespaces are removed.
Returns:
the metadata item.

setString

public Metadata setString(Metadata.StringField field,
                          byte[] val)
Re-initializes the metadata object as string item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setString

public Metadata setString(Metadata.StringField field,
                          java.lang.String val,
                          boolean trim)
Re-initializes the metadata object as string item.

Parameters:
field - the metadata key.
val - the metadata value.
trim - if true, all leading and trailing whitespaces are removed.
Returns:
the metadata item.

setString

public Metadata setString(Metadata.StringField field,
                          java.lang.String val)
Re-initializes the metadata object as string item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setShort

public Metadata setShort(Metadata.IntField field,
                         byte[] val)
Re-initializes the metadata object as short item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setShort

public Metadata setShort(Metadata.IntField field,
                         short val)
Re-initializes the metadata object as short item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setInt

public Metadata setInt(Metadata.IntField field,
                       byte[] val)
Re-initializes the metadata object as integer item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setInt

public Metadata setInt(Metadata.IntField field,
                       int val)
Re-initializes the metadata object as integer item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setLong

public Metadata setLong(Metadata.IntField field,
                        byte[] val)
Re-initializes the metadata object as long item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setLong

public Metadata setLong(Metadata.IntField field,
                        long val)
Re-initializes the metadata object as long item.

Parameters:
field - the metadata key.
val - the metadata value.
Returns:
the metadata item.

setDate

public Metadata setDate(Metadata.DateField f,
                        javax.xml.datatype.XMLGregorianCalendar gcal)
Re-initializes the metadata object as date item.

Parameters:
f - the metadata key.
gcal - the XMLGregorianCalendar instance to take the date value from.
Returns:
the metadata item.

setDuration

public Metadata setDuration(javax.xml.datatype.Duration duration)
Re-initializes the metadata object as duration item.

Parameters:
duration - the duration.
Returns:
the metadata item.