2.17.2: 2011-06-17

net.sf.basedb.core.data
Class ParameterValueData<T>

java.lang.Object
  extended by net.sf.basedb.core.data.BasicData
      extended by net.sf.basedb.core.data.ParameterValueData<T>
All Implemented Interfaces:
IdentifiableData
Direct Known Subclasses:
BooleanParameterValueData, DateParameterValueData, DoubleParameterValueData, FloatParameterValueData, IntegerParameterValueData, ItemParameterValueData, LongParameterValueData, StringParameterValueData, TextParameterValueData, TimestampParameterValueData

public abstract class ParameterValueData<T>
extends BasicData

The base class for the different types of parameter values.

Version:
2.0
Author:
Nicklas, Samuel
See Also:
Parameters overview
Last modified
$Date: 2010-10-01 13:51:57 +0200 (Fri, 01 Oct 2010) $
Hibernate: class
table="`ParameterValues`" discriminator-value="-1" lazy="true" batch-size="10"
Hibernate: discriminator
column="`discriminator`" type="int"

Field Summary
private  String description
           
private  String label
           
static int MAX_DESCRIPTION_LENGTH
          The maximum length of the description of the parameter that can be stored in the database.
static int MAX_LABEL_LENGTH
          The maximum length of the label of the parameter that can be stored in the database.
 
Constructor Summary
ParameterValueData()
           
ParameterValueData(T... values)
           
 
Method Summary
 String getDescription()
          Get the description of the parameter.
 String getLabel()
          Get the label of the parameter.
abstract  List<T> getValues()
          Get values of this parameter.
abstract  int getValueType()
          Get the type of parameter values that are store in this parameter.
 void replaceValues(List<?> values)
          Replace the values in the database with the new values in the specified list.
 void setDescription(String description)
           
 void setLabel(String label)
           
 void setSingleValue(Object value)
          Replace the current list with a single new value.
(package private) abstract  void setValues(List<T> values)
          Set values of this parameter.
 
Methods inherited from class net.sf.basedb.core.data.BasicData
equals, getId, getVersion, hashCode, setId, setVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_LABEL_LENGTH

public static final int MAX_LABEL_LENGTH
The maximum length of the label of the parameter that can be stored in the database.

See Also:
setLabel(String), Constant Field Values

label

private String label

MAX_DESCRIPTION_LENGTH

public static final int MAX_DESCRIPTION_LENGTH
The maximum length of the description of the parameter that can be stored in the database.

See Also:
setDescription(String), Constant Field Values

description

private String description
Constructor Detail

ParameterValueData

ParameterValueData()

ParameterValueData

ParameterValueData(T... values)
Method Detail

getLabel

public String getLabel()
Get the label of the parameter.

Hibernate: property
column="`label`" type="string" size="255" not-null="false"

setLabel

public void setLabel(String label)

getDescription

public String getDescription()
Get the description of the parameter.

Hibernate: property
column="`description`" type="text" not-null="false"

setDescription

public void setDescription(String description)

getValueType

public abstract int getValueType()
Get the type of parameter values that are store in this parameter. The value should correspond to one of the Type.getValue() values, or 0 if the parameter has no corresponding type.

Returns:
An integer value found in the Type enumeration or 0
Since:
2.16

getValues

public abstract List<T> getValues()
Get values of this parameter. Hibernate mapped in each subclass to a bag containing all values for the parameter.

Returns:
Collection of values.

setValues

abstract void setValues(List<T> values)
Set values of this parameter.

NOTE! Used by Hibernate to initialize the object. Do not call AnnotationData.setLastUpdate(java.util.Date)!

Parameters:
values - Collection of values.

replaceValues

public void replaceValues(List<?> values)
Replace the values in the database with the new values in the specified list. It is expected that the list contains only objects of the correct type.

NOTE! When this method is called to set annotation values for an AnnotationData, don't forget to also update the last update timestamp: AnnotationData.setLastUpdate(java.util.Date). and to invalidate the annotation set snapshot: AnnotationSet.setSnapshotInvalid()


setSingleValue

public void setSingleValue(Object value)
Replace the current list with a single new value. It is expected that the value is of the correct type.

NOTE! When this method is called to set annotation values for an AnnotationData, don't forget to also update the last update timestamp: AnnotationData.setLastUpdate(java.util.Date). and to invalidate the annotation set snapshot: AnnotationSet.setSnapshotInvalid()


2.17.2: 2011-06-17