2.17.2: 2011-06-17

net.sf.basedb.plugins.executor
Class ParameterDefinition

java.lang.Object
  extended by net.sf.basedb.plugins.executor.ParameterDefinition

public class ParameterDefinition
extends Object

Represents a parameter definition for the external program. A name and type is required. All other settings are optional. Supported values for type is:

Since:
2.15
Author:
Nicklas

Field Summary
private  String defaultValue
           
private  String description
           
private static URL dtdFile
           
private  boolean multiple
           
private  String name
           
private  Map<String,String> options
           
private  boolean required
           
private  String type
           
 
Constructor Summary
ParameterDefinition()
          Create a new empty parameter definition.
 
Method Summary
 String getDefaultValue()
          Get the default value for this parameter.
 String getDescription()
          Get a description/help text about this parameter.
 String getName()
          Get the name of the parameter.
 String getOption(String key)
          Get the value for an option.
 Set<String> getOptions()
          Get the names of other options that are defined for this parmeter.
 String getType()
          Get the type of the parameter.
 boolean isMultiple()
          Can this parameter have multiple values or only one?
 boolean isRequired()
          Is this parameter a required parameter or not?
static List<ParameterDefinition> parseXml(String xml, boolean validate)
          Parse an XML document containing parameter definitions.
 void setDefaultValue(String defaultValue)
          Set the default value for this parameter.
 void setDescription(String description)
          Set a description/help text for this parmeter.
 void setMultiple(boolean multiple)
          Set if this parameter can have multiple values or only one.
 void setName(String name)
          Set the name of the parameter.
 void setOption(String key, String value)
          Set the value for an option.
 void setRequired(boolean required)
          Set if this parameter should be a required or optional parameter.
 void setType(String type)
          Set the type of the parameter.
 PluginParameter<?> toPluginParameter(DbControl dc, BioAssaySet source)
          Convert this parameter definition to a PluginParameter object.
 String toXmlFragment(boolean compact)
          Render this parameter definition as an XML fragment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dtdFile

private static final URL dtdFile

type

private String type

name

private String name

required

private boolean required

multiple

private boolean multiple

defaultValue

private String defaultValue

description

private String description

options

private Map<String,String> options
Constructor Detail

ParameterDefinition

public ParameterDefinition()
Create a new empty parameter definition. Before it can be used a name and type must be specified.

Method Detail

parseXml

public static List<ParameterDefinition> parseXml(String xml,
                                                 boolean validate)
Parse an XML document containing parameter definitions.

Parameters:
xml - The xml as a string (with or without a DOCTYPE declaration)
validate - TRUE to validate the XML against the dtd (external-plugin-parameters.dtd)
Returns:
A list with parameter definition

getType

public String getType()
Get the type of the parameter.


setType

public void setType(String type)
Set the type of the parameter. For supported values see the class documentation.


getName

public String getName()
Get the name of the parameter. This value is required.


setName

public void setName(String name)
Set the name of the parameter.


isRequired

public boolean isRequired()
Is this parameter a required parameter or not?


setRequired

public void setRequired(boolean required)
Set if this parameter should be a required or optional parameter.


isMultiple

public boolean isMultiple()
Can this parameter have multiple values or only one?


setMultiple

public void setMultiple(boolean multiple)
Set if this parameter can have multiple values or only one.


getDefaultValue

public String getDefaultValue()
Get the default value for this parameter.


setDefaultValue

public void setDefaultValue(String defaultValue)
Set the default value for this parameter.


getDescription

public String getDescription()
Get a description/help text about this parameter.


setDescription

public void setDescription(String description)
Set a description/help text for this parmeter.


getOptions

public Set<String> getOptions()
Get the names of other options that are defined for this parmeter. Useful options depend on the parameter type and are described in the class documentation.


getOption

public String getOption(String key)
Get the value for an option.


setOption

public void setOption(String key,
                      String value)
Set the value for an option.


toXmlFragment

public String toXmlFragment(boolean compact)
Render this parameter definition as an XML fragment. Multiple fragments can be concatenated and then wrapped with:

Parameters:
compact - If TRUE, the generated XML is compacted and without line breaks.
Returns:
An XML representation of this parameter definition

toPluginParameter

public PluginParameter<?> toPluginParameter(DbControl dc,
                                            BioAssaySet source)
Convert this parameter definition to a PluginParameter object.

Parameters:
dc - A DbControl to use for database access
source - The source bioassay set

2.17.2: 2011-06-17