2.17.2: 2011-06-17

net.sf.basedb.util.export.spotdata
Class AssayPropertyField

java.lang.Object
  extended by net.sf.basedb.util.export.spotdata.AssayPropertyField
All Implemented Interfaces:
AssayField, ExportableField

public class AssayPropertyField
extends Object
implements AssayField

Assay field implementation that exports a named property from a bioassay. The default setting will export the "name" property. One instance of this class is considered to be equal to another if they are configured with the same property and title.

Since:
2.15
Author:
Nicklas
Last modified
$Date: 2010-08-03 11:11:54 +0200 (Tue, 03 Aug 2010) $

Field Summary
private  Formatter<?> formatter
           
private  Metadata<BioAssay> metadata
           
private  String property
           
private  Metadata.PropertyPath<BioAssay,?> propertyPath
           
private  String title
           
private  Type type
           
 
Constructor Summary
AssayPropertyField()
          Create a new annotation field.
 
Method Summary
 boolean equals(Object obj)
          An assay field is equal to another assay field if it uses the same property and has the same title.
 Collection<?> getAssayValue(DbControl dc, BioAssay ba)
          Return all values that are given by the specified property.
 Formatter<?> getFormatter()
          Get a formatter that converts the values in this field to strings.
 String getProperty()
          Get the configured property.
 String getTitle()
          Get the column header.
 Type getType()
          Get the data type of the field.
 int hashCode()
           
 boolean isAnnotation()
          A boolean flag indicating if the field is an annotation or not.
 void setFormatter(Formatter<?> formatter)
          Set a formatter to use for formatting the exported values.
 void setProperty(String property)
          Set the property that should be exported.
 void setTitle(String title)
          Set the title of the exported property.
 void setType(Type type)
          Set the data type of the exported property.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

metadata

private final Metadata<BioAssay> metadata

propertyPath

private Metadata.PropertyPath<BioAssay,?> propertyPath

property

private String property

title

private String title

type

private Type type

formatter

private Formatter<?> formatter
Constructor Detail

AssayPropertyField

public AssayPropertyField()
Create a new annotation field. The property is automatically set to "name". Call setProperty(String) and setTitle(String) to change.

See Also:
ExportableFieldFactory.assayProperty(String, String, Type, Formatter)
Method Detail

getTitle

public String getTitle()
Description copied from interface: ExportableField
Get the column header.

Specified by:
getTitle in interface ExportableField

getAssayValue

public Collection<?> getAssayValue(DbControl dc,
                                   BioAssay ba)
Return all values that are given by the specified property.

Specified by:
getAssayValue in interface AssayField
Parameters:
dc - The DbControl that is used for database access
ba - The bioassay to get the value(s) from
Returns:
A collection with one or more values, or null or an empty collection if there is no value for the given bioassay

getType

public Type getType()
Description copied from interface: ExportableField
Get the data type of the field.

Specified by:
getType in interface ExportableField
Returns:
A type object or null if not known

getFormatter

public Formatter<?> getFormatter()
Description copied from interface: ExportableField
Get a formatter that converts the values in this field to strings.

Specified by:
getFormatter in interface ExportableField
Returns:
A formatter or null to use default formatting (normally this means calling the toString() method).

isAnnotation

public boolean isAnnotation()
Description copied from interface: AssayField
A boolean flag indicating if the field is an annotation or not.

Specified by:
isAnnotation in interface AssayField
Returns:
Always FALSE

equals

public boolean equals(Object obj)
An assay field is equal to another assay field if it uses the same property and has the same title.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

setProperty

public void setProperty(String property)
Set the property that should be exported. For syntax see Metadata.getPropertyPath(String, boolean). Do not forget to also change the title.


getProperty

public String getProperty()
Get the configured property.


setTitle

public void setTitle(String title)
Set the title of the exported property.


setType

public void setType(Type type)
Set the data type of the exported property.

Since:
2.15

setFormatter

public void setFormatter(Formatter<?> formatter)
Set a formatter to use for formatting the exported values.


2.17.2: 2011-06-17