View Javadoc

1   /*
2    * Copyright 2004-2010 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  
17  package org.seasar.cubby.controller.impl;
18  
19  import org.seasar.cubby.controller.FormatPattern;
20  
21  /**
22   * 日付や時刻のフォーマットパターンを保持するクラスの実装です。
23   * 
24   * @author baba
25   */
26  public class DefaultFormatPattern implements FormatPattern {
27  
28  	/**
29  	 * 日付フォーマットパターン
30  	 */
31  	private String datePattern = "yyyy-MM-dd";
32  
33  	/**
34  	 * 時刻フォーマットパターン
35  	 */
36  	private String timePattern = "HH:mm:ss";
37  
38  	/**
39  	 * 日付時刻フォーマットパターン
40  	 */
41  	private String timestampPattern = "yyyy-MM-dd HH:mm:ss";
42  
43  	/**
44  	 * 日付フォーマットパターンを取得します。
45  	 * 
46  	 * @return 日付フォーマットパターン
47  	 */
48  	public String getDatePattern() {
49  		return datePattern;
50  	}
51  
52  	/**
53  	 * 日付フォーマットパターンをセットします。
54  	 * 
55  	 * @param datePattern
56  	 *            日付フォーマットパターン
57  	 */
58  	public void setDatePattern(final String datePattern) {
59  		this.datePattern = datePattern;
60  	}
61  
62  	/**
63  	 * 時刻フォーマットパターンを取得します。
64  	 * 
65  	 * @return 時刻フォーマットパターン
66  	 */
67  	public String getTimePattern() {
68  		return timePattern;
69  	}
70  
71  	/**
72  	 * 時刻フォーマットパターンをセットします。
73  	 * 
74  	 * @param timePattern
75  	 *            時刻フォーマットパターン
76  	 */
77  	public void setTimePattern(final String timePattern) {
78  		this.timePattern = timePattern;
79  	}
80  
81  	/**
82  	 * 日付時刻フォーマットパターンを取得します。
83  	 * 
84  	 * @return 日付時刻フォーマットパターン
85  	 */
86  	public String getTimestampPattern() {
87  		return timestampPattern;
88  	}
89  
90  	/**
91  	 * 日付時刻フォーマットパターンをセットします。
92  	 * 
93  	 * @param timestampPattern
94  	 *            日付時刻フォーマットパターン
95  	 */
96  	public void setTimestampPattern(final String timestampPattern) {
97  		this.timestampPattern = timestampPattern;
98  	}
99  
100 	/**
101 	 * このオブジェクトの文字列表現を取得します。
102 	 * 
103 	 * @return このオブジェクトの文字列表現
104 	 */
105 	@Override
106 	public String toString() {
107 		final StringBuilder builder = new StringBuilder();
108 		builder.append(super.toString());
109 		builder.append("[datePattern=");
110 		builder.append(datePattern);
111 		builder.append(",timePattern=");
112 		builder.append(timePattern);
113 		builder.append(",timestampPattern=");
114 		builder.append(timestampPattern);
115 		builder.append("]");
116 		return builder.toString();
117 	}
118 
119 }