roaddefectsearchdatecommand.java

来自「Java的框架」· Java 代码 · 共 129 行

JAVA
129
字号
package mcaps.apps.prrm.roaddefect.webapp.command;

import java.util.Date;
import java.util.List;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * This class holds the parameter values for the use of RoadDefectSearchForm 
 * controller class.
 * 
 * @author jov
 * @date Sep 23, 2005
 * @version 1.0.1.0
 */
public class RoadDefectSearchDateCommand {
	private String startDate = null;
	private String endDate  = null;
	private String dateFormat;
	private List roadDefectList;
	
	
	/**
	 * Returns the dateFormat.
	 * @return String
	 */
	public String getDateFormat () {
		return dateFormat;
	}

	
	/**
	 * Sets the dateFormat.
	 * @param dateFormat The dateFormat to set.
	 */
	public void setDateFormat (String dateFormat) {
		this.dateFormat = dateFormat;
	}

	
	/**
	 * Returns the endDate.
	 * @return String
	 */
	public String getEndDate () {
		return endDate;
	}

	
	/**
	 * Sets the endDate.
	 * @param endDate The endDate to set.
	 */
	public void setEndDate (String endDate) {
		this.endDate = endDate;
	}

	
	/**
	 * Returns the roadDefectList.
	 * @return List
	 */
	public List getRoadDefectList () {
		return roadDefectList;
	}

	
	/**
	 * Sets the roadDefectList.
	 * @param roadDefectList The roadDefectList to set.
	 */
	public void setRoadDefectList (List roadDefectList) {
		this.roadDefectList = roadDefectList;
	}

	
	/**
	 * Returns the startDate.
	 * @return String
	 */
	public String getStartDate () {
		return startDate;
	}

	
	/**
	 * Sets the startDate.
	 * @param startDate The startDate to set.
	 */
	public void setStartDate (String startDate) {
		this.startDate = startDate;
	}

	
	/**
	 * @return
	 */
	public Date convertStartDate(){
		try{
			if (this.startDate == null) return null;
			if (this.startDate.length() < 1) return null;
			SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
			df.setLenient(true);
			Date dt = df.parse(this.startDate);
			return dt;
		}catch (ParseException e){
			return null;
		}
	}
	
	/**
	 * @return
	 */
	public Date convertEndDate(){
		try{
			if (this.endDate == null) return null;
			if (this.endDate.length() < 1) return null;
			SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
			df.setLenient(true);
			Date dt = df.parse(this.endDate);
			return dt;
		}catch (ParseException e){
			return null;
		}
	}
	
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?