com.arsdigita.bebop.parameters
Class DateTimeParameter

java.lang.Object
  extended bycom.arsdigita.bebop.parameters.ParameterModel
      extended bycom.arsdigita.bebop.parameters.DateTimeParameter
All Implemented Interfaces:
Lockable

public class DateTimeParameter
extends ParameterModel

A class that represents the model for date and time form parameters. (based on the code in DateParameter.java)

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/parameters/DateTimeParameter.java#9 $
Author:
Scot Seago, Uday Mathur

Field Summary
 
Fields inherited from class com.arsdigita.bebop.parameters.ParameterModel
m_defaultValue, m_locked, m_name, m_parameterListeners, versionId
 
Constructor Summary
DateTimeParameter(String name)
           
 
Method Summary
protected  Calendar getCalendar(javax.servlet.http.HttpServletRequest request)
          This method returns a new Calendar object that is manipulated within transformValue to create a Date Object.
 Class getValueClass()
          Return the class that all values produced by the model will have.
 String marshal(Object value)
          Produce a string representation of the given value.
 Object transformValue(javax.servlet.http.HttpServletRequest request)
          Computes a dateTime object from multiple parameters in the request.
 Object unmarshal(String encoded)
          Reconstruct the parameter value from an encoded string produced by marshal.
 
Methods inherited from class com.arsdigita.bebop.parameters.ParameterModel
addParameterListener, createParameterData, createParameterData, createParameterData, getDefaultOverridesNull, getDefaultValue, getName, isLocked, isPassIn, lock, setDefaultOverridesNull, setDefaultValue, setName, setPassIn, transformSingleValue, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateTimeParameter

public DateTimeParameter(String name)
Method Detail

getCalendar

protected Calendar getCalendar(javax.servlet.http.HttpServletRequest request)
This method returns a new Calendar object that is manipulated within transformValue to create a Date Object. This method should be overridden if you wish to use a Calendar other than the lenient GregorianCalendar.

Parameters:
request - the servlet request from which Locale can be extracted if needed
Returns:
a new Calendar object

transformValue

public Object transformValue(javax.servlet.http.HttpServletRequest request)
                      throws IllegalArgumentException
Computes a dateTime object from multiple parameters in the request. This method searches for parameters named getName() + ".year", getName() + ".month", getName() + ".day", getName() + ".hour", getName() + ".minute", getName() + ".second", and getName() + ".amOrPm".

Specified by:
transformValue in class ParameterModel
Parameters:
request - The HttpServletRequest of the form submission.
Throws:
IllegalArgumentException - if there is an error transforming form/URL variables to an object.

unmarshal

public Object unmarshal(String encoded)
Description copied from class: ParameterModel
Reconstruct the parameter value from an encoded string produced by marshal. This is an optional operation, which needs to be implemented by specific subclasses; this implementation just throws an UnsupportedOperationException.

The contract between marshal and unmarshal is that for any possible object obj this parameter model can produce obj.equals(unmarshal(marshal(obj)).

Overrides:
unmarshal in class ParameterModel
Parameters:
encoded - a string produced by marshal
Returns:
the object represented by encoded

marshal

public String marshal(Object value)
Description copied from class: ParameterModel
Produce a string representation of the given value. The parameter model has to be able to read the resulting string back into the right object o so that value.equals(o).

Overrides:
marshal in class ParameterModel
Parameters:
value - a value previously produced by this parameter model
Returns:
the value as a readable string, may be null

getValueClass

public Class getValueClass()
Description copied from class: ParameterModel
Return the class that all values produced by the model will have. This should be the most specific common base class of all classes of which the model will ever produce values. This implementation returns Object.class

Overrides:
getValueClass in class ParameterModel
Returns:
the class that all values produced by the model will have.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC