org.mycore.services.fieldquery
Class MCRFieldValue

java.lang.Object
  extended by org.mycore.services.fieldquery.MCRFieldValue
Direct Known Subclasses:
MCRQueryCondition

public class MCRFieldValue
extends Object

Represents the value of a field in a query. This can be a value that is part of the query results (hit sort data or meta data) or a value that is built when data is indexed.

Author:
Frank Lützenkirchen

Constructor Summary
MCRFieldValue(MCRFieldDef field, MCRFile file)
          Creates a new field value
MCRFieldValue(MCRFieldDef field, String value)
          Creates a new field value
 
Method Summary
 Element buildXML()
          Builds a XML representation of this field's value
 MCRFieldDef getField()
          Returns the field this value belongs to
 MCRFile getFile()
          Returns the MCRFile thats content should become the value of the field when indexing data
 String getValue()
          Returns the value of the field as a String
static MCRFieldValue parseXML(Element xml)
          Parses a XML representation of a field value
 void setValue(String value)
          Sets or updates the field value
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MCRFieldValue

public MCRFieldValue(MCRFieldDef field,
                     String value)
Creates a new field value

Parameters:
field - the field this value belongs to
value - the value of the field, as a String

MCRFieldValue

MCRFieldValue(MCRFieldDef field,
              MCRFile file)
Creates a new field value

Parameters:
field - the field this value belongs to
file - the MCRFile thats content should become the value of the field when indexing data
Method Detail

getField

public MCRFieldDef getField()
Returns the field this value belongs to


setValue

public void setValue(String value)
Sets or updates the field value

Parameters:
value - the value, whicht will be normalized

getValue

public String getValue()
Returns the value of the field as a String

Returns:
the value of the field as a String, or null if the value is the content of an MCRFile
See Also:
getFile()

getFile

public MCRFile getFile()
Returns the MCRFile thats content should become the value of the field when indexing data

Returns:
the MCRFile to be indexed, or null if the value can be retrieved using the getValue() method
See Also:
getValue()

buildXML

public Element buildXML()
Builds a XML representation of this field's value

Returns:
a 'field' element with attribute 'name' and the value as element content

parseXML

public static MCRFieldValue parseXML(Element xml)
Parses a XML representation of a field value

Parameters:
xml - the field value as XML element
Returns:
the parsed MCRFieldValue object

toString

public String toString()
Overrides:
toString in class Object