com.zion.jbuddy.bots
Class BotParameter

java.lang.Object
  extended by com.zion.jbuddy.bots.BotParameter
All Implemented Interfaces:
BotCall

public class BotParameter
extends Object
implements BotCall

Asks a user for input.

The user is prompted with the parameter's description. They may then enter a value for the parameter. The value's expected format depends on the parameter's type, as well as any validation patterns that may be set.

A user's parameter values may be recalled from within a BotActionTask. They may also be referenced by their parameter names using content variables. For example, the following target asks for user input, then echos back the values:

<target command="entername"> <parameter name="first"> <description>Enter your first name:</description> </parameter> <parameter name="last"> <description>Enter your last name:</description> </parameter> <content>You entered: ${first} ${last}</content> </target>

Parameters may also be hidden. In this case, a value is explicitly set, and users are not prompted to enter a value.


Constructor Summary
BotParameter(BotParameterType type, String name)
          Creates a parameter.
 
Method Summary
 Object clone()
          Makes an exact copy of this parameter.
 String getCancelCommand()
          Returns the cancel command.
 DateFormat getDateFormat()
          Returns the date format to use.
 BotDateTimeStyle getDateStyle()
          Returns the date style to use.
 RichContent getDescription()
          Returns this parameter's description.
 Locale getLocale()
          Returns the locale to use for this parameter.
 String getName()
          Returns this parameter's name.
 NumberFormat getNumberFormat()
          Returns the number format to use.
 BotPatternSet getPatterns()
          Returns this parameter's validation patterns.
 BotDateTimeStyle getTimeStyle()
          Returns the time style to use.
 BotParameterType getType()
          Returns this parameter's type.
 String getValue()
          Returns this parameter's value.
 boolean isHidden()
          Returns whether this parameter is hidden.
 void setCancelCommand(String cancelCommand)
          Sets the cancel command.
 void setDateFormat(DateFormat dateFormat)
          Sets the date format to use.
 void setDateStyle(BotDateTimeStyle dateStyle)
          The date style to use.
 void setDescription(RichContent description)
          Sets this parameter's description.
 void setHidden(boolean isHidden)
          Sets whether this parameter is hidden.
 void setLocale(Locale locale)
          Sets the locale to use for this parameter.
 void setName(String name)
          Sets this parameter's name.
 void setNumberFormat(NumberFormat numberFormat)
          Sets the number format to use.
 void setTimeStyle(BotDateTimeStyle timeStyle)
          Sets the time style to use.
 void setType(BotParameterType type)
          Sets this parameter's type.
 void setValue(String value)
          Sets this parameter's value.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BotParameter

public BotParameter(BotParameterType type,
                    String name)
Creates a parameter.

Parameters:
type - the parameter's type
name - the parameter's name
Method Detail

getType

public BotParameterType getType()
Returns this parameter's type.


setType

public void setType(BotParameterType type)
Sets this parameter's type.


getName

public String getName()
Returns this parameter's name.


setName

public void setName(String name)
Sets this parameter's name.


getDescription

public RichContent getDescription()
Returns this parameter's description.


setDescription

public void setDescription(RichContent description)
Sets this parameter's description.

This is the message the user is prompted with. If a description is not specified, a reasonable default is used.


isHidden

public boolean isHidden()
Returns whether this parameter is hidden.


setHidden

public void setHidden(boolean isHidden)
Sets whether this parameter is hidden.

If true, users will not be prompted to enter a value for this parameter.

The default value is false.


getValue

public String getValue()
Returns this parameter's value.


setValue

public void setValue(String value)
Sets this parameter's value.

If this parameter is hidden, this value is used, and users will not be prompted to enter a value for this parameter. Otherwise, users will be prompted, and this value will be ignored.

This value can contain content variables.


getCancelCommand

public String getCancelCommand()
Returns the cancel command.


setCancelCommand

public void setCancelCommand(String cancelCommand)
Sets the cancel command.

A user can enter this command to cancel the parameter, instead of entering a value. This also cancels further execution of the target or event handler that called this parameter.

The default cancel command is "cancel".


getPatterns

public BotPatternSet getPatterns()
Returns this parameter's validation patterns.

If any patterns are set, a user value must match at least one of them to be considered valid. If a user value is not valid, the user is sent an error message and prompted again to enter a value.


getLocale

public Locale getLocale()
Returns the locale to use for this parameter.


setLocale

public void setLocale(Locale locale)
Sets the locale to use for this parameter.

Affects the accepted values/syntax for number, date, and time-related parameters.


getNumberFormat

public NumberFormat getNumberFormat()
Returns the number format to use.


setNumberFormat

public void setNumberFormat(NumberFormat numberFormat)
Sets the number format to use.

Valid only for number, currency, and percent parameters.


getDateStyle

public BotDateTimeStyle getDateStyle()
Returns the date style to use.


setDateStyle

public void setDateStyle(BotDateTimeStyle dateStyle)
The date style to use.

Valid only for DATE and DATE_TIME parameters.


getTimeStyle

public BotDateTimeStyle getTimeStyle()
Returns the time style to use.


setTimeStyle

public void setTimeStyle(BotDateTimeStyle timeStyle)
Sets the time style to use.

Valid only for TIME and DATE_TIME parameters.


getDateFormat

public DateFormat getDateFormat()
Returns the date format to use.


setDateFormat

public void setDateFormat(DateFormat dateFormat)
Sets the date format to use.

Valid only for date, time, and date-time parameters.


clone

public Object clone()
Makes an exact copy of this parameter.

Overrides:
clone in class Object

toString

public String toString()
Overrides:
toString in class Object


JBuddy is a trademark of Zion Software, LLC in the US and other countries.
Copyright 2000-2008 Zion Software, LLC All Rights Reserved.