org.apache.turbine.services.intake.model
Class BooleanField

java.lang.Object
  extended byorg.apache.turbine.services.intake.model.Field
      extended byorg.apache.turbine.services.intake.model.BooleanField

public class BooleanField
extends Field

Processor for boolean fields.

Version:
$Id: BooleanField.java 646752 2008-04-10 10:56:15Z tv $
Author:
John McNally, Henning P. Schmiedehausen, Quinton McCombs

Field Summary
 
Fields inherited from class org.apache.turbine.services.intake.model.Field
alwaysRequired, defaultFieldPackage, defaultValidatorPackage, defaultValue, displayName, emptyValue, getter, group, ifRequiredMessage, initialized, isDebugEnabled, isMultiValued, key, log, mapToObject, message, name, onError, parser, required, retrievable, setFlag, setter, validated, validator, validFlag
 
Constructor Summary
BooleanField(XmlField field, Group group)
           
 
Method Summary
 boolean booleanValue()
          Gets the boolean value of the field.
protected  void doSetValue()
          Sets the value of the field from data in the parser.
protected  java.lang.String getDefaultValidator()
          A suitable validator.
protected  java.lang.Object getSafeEmptyValue()
          Provides access to emptyValue such that the value returned will be acceptable as an argument parameter to Method.invoke.
 void setDefaultValue(java.lang.String prop)
          Sets the default value for a Boolean field
 void setEmptyValue(java.lang.String prop)
          Set the empty Value.
 
Methods inherited from class org.apache.turbine.services.intake.model.Field
dispose, doSetValue, getDefault, getDefaultValue, getDisplayName, getDisplaySize, getEmptyValue, getGroup, getHTMLString, getInitialValue, getKey, getLocale, getMaxSize, getMessage, getName, getProperty, getStringValue, getTestValue, getValidator, getValue, getValueIfAbsent, init, init, isMultiValued, isRequired, isSet, isValid, isValidated, removeFromRequest, setDisplayName, setMessage, setProperty, setRequired, setRequired, toString, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanField

public BooleanField(XmlField field,
                    Group group)
             throws IntakeException
Method Detail

setDefaultValue

public void setDefaultValue(java.lang.String prop)
Sets the default value for a Boolean field

Specified by:
setDefaultValue in class Field
Parameters:
prop - Parameter for the default values

setEmptyValue

public void setEmptyValue(java.lang.String prop)
Set the empty Value. This value is used if Intake maps a field to a parameter returned by the user and the corresponding field is either empty (empty string) or non-existant.

Specified by:
setEmptyValue in class Field
Parameters:
prop - The value to use if the field is empty.

getSafeEmptyValue

protected java.lang.Object getSafeEmptyValue()
Provides access to emptyValue such that the value returned will be acceptable as an argument parameter to Method.invoke. Subclasses that deal with primitive types should ensure that they return an appropriate value wrapped in the object wrapper class for the primitive type.

Overrides:
getSafeEmptyValue in class Field
Returns:
the value to use when the field is empty or an Object that wraps the empty value for primitive types.

getDefaultValidator

protected java.lang.String getDefaultValidator()
A suitable validator.

Overrides:
getDefaultValidator in class Field
Returns:
class name of the validator

doSetValue

protected void doSetValue()
Sets the value of the field from data in the parser.

Specified by:
doSetValue in class Field

booleanValue

public boolean booleanValue()
Gets the boolean value of the field. A value of false will be returned if the value of the field is null.

Returns:
value of the field.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.