jsky.catalog
Class FieldDescAdapter

java.lang.Object
  extended by jsky.catalog.FieldDescAdapter
All Implemented Interfaces:
java.io.Serializable, FieldDesc

public class FieldDescAdapter
extends java.lang.Object
implements FieldDesc, java.io.Serializable

This class provides a default implementation of the FieldDesc interface, used to describes a catalog field (column or query parameter).

See Also:
Serialized Form

Constructor Summary
FieldDescAdapter()
          Create an empty field description
FieldDescAdapter(java.lang.String name)
          Create a field description with the given name
 
Method Summary
 int getDefaultOptionIndex()
          Return the index of the default option, or -1 if there is no default.
 java.lang.Object getDefaultValue()
          Return the default value for this field, or null if there is no default.
 java.lang.String getDescription()
          Return a more detailed description of this field.
 java.net.URL getDocURL()
          Return a URL pointing to documentation for this field, or null if not available
 java.lang.Class getFieldClass()
          Return the class to use to store values in this field.
 java.lang.String getFormat()
          Return a string describing the format of the field, if known, otherwise null
 java.lang.String getId()
          Return the Id of this field.
 java.lang.String getLinkText(TableQueryResult tableQueryResult, java.lang.Object value, int row, int column)
          Return the text to display for the link, if there is one, otherwise null.
 QueryResult getLinkValue(TableQueryResult tableQueryResult, java.lang.Object value, int row)
          If this field has a link, follow it and return the value it points to as a QueryResult.
 java.lang.String getName()
          Return the name of this field.
 int getNumOptions()
          If the field may only have a limited number of values, return the number of values, otherwise 0.
 java.lang.String getOptionName(int i)
          Return the name of the ith option for this field.
 java.lang.Object getOptionValue(int i)
          Return the value of the ith option for this field.
 java.lang.String getType()
          Return a string describing the semantic type of the field (for example: "ra", "dec", "radius").
 java.lang.String getUnits()
          Return a string describing the units of the field values, if known (for example: "arcmin", "arcsec", "deg")
 java.lang.Object getValue(java.lang.String s)
          Parse the given string into the correct class type for this field and return the value.
 boolean hasLink()
          Return true if the field has a link pointing to more data.
 boolean isDec()
          Return true if this field contains a world coordinates Dec value.
 boolean isId()
          Return true if this field is the unique id.
 boolean isMax()
          Return true if this field is the max value of a range.
 boolean isMin()
          Return true if this field is the min value of a range.
 boolean isRA()
          Return true if this field contains a world coordinates RA value.
 boolean isValid(java.lang.Object value)
          Return true if the given value is valid for this field, otherwise false.
 void setDefaultValue(java.lang.Object v)
          Set the default value for this field.
 void setDescription(java.lang.String description)
           
 void setFieldClass(java.lang.Class fieldClass)
           
 void setFormat(java.lang.String format)
          Set a string describing the format of the field, if known
 void setId(java.lang.String id)
           
 void setIsDec(boolean flag)
          Set to true if this field contains a world coordinates RA value.
 void setIsId(boolean flag)
          Set to true if this field contains the unique id
 void setIsMax(boolean b)
          Set to true if this field is the max value of a range.
 void setIsMin(boolean b)
          Set to true if this field is the min value of a range.
 void setIsRA(boolean flag)
          Set to true if this field contains a world coordinates RA value.
 void setName(java.lang.String name)
           
 void setOptions(NameValue[] options)
          Set the field options to a list of NameValue objects.
 void setType(java.lang.String type)
          Set a string describing the semantic type of the field (for example: "ra", "dec", "radius")
 void setUnits(java.lang.String units)
          Set the units of the field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldDescAdapter

public FieldDescAdapter()
Create an empty field description


FieldDescAdapter

public FieldDescAdapter(java.lang.String name)
Create a field description with the given name

Method Detail

setId

public void setId(java.lang.String id)

getId

public java.lang.String getId()
Description copied from interface: FieldDesc
Return the Id of this field.

Specified by:
getId in interface FieldDesc

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()
Description copied from interface: FieldDesc
Return the name of this field.

Specified by:
getName in interface FieldDesc

setType

public void setType(java.lang.String type)
Set a string describing the semantic type of the field (for example: "ra", "dec", "radius")


getType

public java.lang.String getType()
Return a string describing the semantic type of the field (for example: "ra", "dec", "radius").

Specified by:
getType in interface FieldDesc
See Also:
FieldDesc.getFieldClass()

setUnits

public void setUnits(java.lang.String units)
Set the units of the field


getUnits

public java.lang.String getUnits()
Return a string describing the units of the field values, if known (for example: "arcmin", "arcsec", "deg")

Specified by:
getUnits in interface FieldDesc

setFormat

public void setFormat(java.lang.String format)
Set a string describing the format of the field, if known


getFormat

public java.lang.String getFormat()
Return a string describing the format of the field, if known, otherwise null

Specified by:
getFormat in interface FieldDesc

setDescription

public void setDescription(java.lang.String description)

getDescription

public java.lang.String getDescription()
Description copied from interface: FieldDesc
Return a more detailed description of this field.

Specified by:
getDescription in interface FieldDesc

setFieldClass

public void setFieldClass(java.lang.Class fieldClass)

getFieldClass

public java.lang.Class getFieldClass()
Description copied from interface: FieldDesc
Return the class to use to store values in this field.

Specified by:
getFieldClass in interface FieldDesc

getValue

public java.lang.Object getValue(java.lang.String s)
Parse the given string into the correct class type for this field and return the value.

Specified by:
getValue in interface FieldDesc

getDefaultValue

public java.lang.Object getDefaultValue()
Return the default value for this field, or null if there is no default.

Specified by:
getDefaultValue in interface FieldDesc

setDefaultValue

public void setDefaultValue(java.lang.Object v)
Set the default value for this field.


setOptions

public void setOptions(NameValue[] options)
Set the field options to a list of NameValue objects.


getNumOptions

public int getNumOptions()
If the field may only have a limited number of values, return the number of values, otherwise 0.

Specified by:
getNumOptions in interface FieldDesc

getDefaultOptionIndex

public int getDefaultOptionIndex()
Return the index of the default option, or -1 if there is no default.

Specified by:
getDefaultOptionIndex in interface FieldDesc

getOptionName

public java.lang.String getOptionName(int i)
Return the name of the ith option for this field.

Specified by:
getOptionName in interface FieldDesc

getOptionValue

public java.lang.Object getOptionValue(int i)
Return the value of the ith option for this field.

Specified by:
getOptionValue in interface FieldDesc

isValid

public boolean isValid(java.lang.Object value)
Return true if the given value is valid for this field, otherwise false.

Specified by:
isValid in interface FieldDesc

getDocURL

public java.net.URL getDocURL()
Return a URL pointing to documentation for this field, or null if not available

Specified by:
getDocURL in interface FieldDesc

hasLink

public boolean hasLink()
Return true if the field has a link pointing to more data.

Specified by:
hasLink in interface FieldDesc

getLinkText

public java.lang.String getLinkText(TableQueryResult tableQueryResult,
                                    java.lang.Object value,
                                    int row,
                                    int column)
Return the text to display for the link, if there is one, otherwise null.

Specified by:
getLinkText in interface FieldDesc
Parameters:
tableQueryResult - object representing the table data
value - the value in the table cell
row - the row in the table
column - the column in the table
Throws:
java.lang.RuntimeException - if the field is not a link

getLinkValue

public QueryResult getLinkValue(TableQueryResult tableQueryResult,
                                java.lang.Object value,
                                int row)
                         throws java.net.MalformedURLException
If this field has a link, follow it and return the value it points to as a QueryResult.

Specified by:
getLinkValue in interface FieldDesc
Parameters:
tableQueryResult - object representing the table data
value - the value in the table cell
row - the row in the table
Throws:
java.net.MalformedURLException - if the value is not valid URL string
java.lang.RuntimeException - if the value is not a string

isId

public boolean isId()
Return true if this field is the unique id.

Specified by:
isId in interface FieldDesc

setIsId

public void setIsId(boolean flag)
Set to true if this field contains the unique id


isRA

public boolean isRA()
Return true if this field contains a world coordinates RA value.

Specified by:
isRA in interface FieldDesc

setIsRA

public void setIsRA(boolean flag)
Set to true if this field contains a world coordinates RA value.


isDec

public boolean isDec()
Return true if this field contains a world coordinates Dec value.

Specified by:
isDec in interface FieldDesc

setIsDec

public void setIsDec(boolean flag)
Set to true if this field contains a world coordinates RA value.


isMin

public boolean isMin()
Return true if this field is the min value of a range.

Specified by:
isMin in interface FieldDesc

setIsMin

public void setIsMin(boolean b)
Set to true if this field is the min value of a range.


isMax

public boolean isMax()
Return true if this field is the max value of a range.

Specified by:
isMax in interface FieldDesc

setIsMax

public void setIsMax(boolean b)
Set to true if this field is the max value of a range.