View Javadoc

1   /*
2    * Copyright 2004-2009 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  package org.seasar.cubby.controller.impl;
17  
18  import org.seasar.cubby.controller.FormatPattern;
19  
20  /**
21   * 日付や時刻のフォーマットパターンを保持するクラスの実装です。
22   * 
23   * @author baba
24   */
25  public class DefaultFormatPattern implements FormatPattern {
26  
27  	/**
28  	 * 日付フォーマットパターン
29  	 */
30  	private String datePattern = "yyyy-MM-dd";
31  
32  	/**
33  	 * 時刻フォーマットパターン
34  	 */
35  	private String timePattern = "HH:mm:ss";
36  
37  	/**
38  	 * 日付時刻フォーマットパターン
39  	 */
40  	private String timestampPattern = "yyyy-MM-dd HH:mm:ss";
41  
42  	/**
43  	 * 日付フォーマットパターンを取得します。
44  	 * 
45  	 * @return 日付フォーマットパターン
46  	 */
47  	public String getDatePattern() {
48  		return datePattern;
49  	}
50  
51  	/**
52  	 * 日付フォーマットパターンをセットします。
53  	 * 
54  	 * @param datePattern
55  	 *            日付フォーマットパターン
56  	 */
57  	public void setDatePattern(final String datePattern) {
58  		this.datePattern = datePattern;
59  	}
60  
61  	/**
62  	 * 時刻フォーマットパターンを取得します。
63  	 * 
64  	 * @return 時刻フォーマットパターン
65  	 */
66  	public String getTimePattern() {
67  		return timePattern;
68  	}
69  
70  	/**
71  	 * 時刻フォーマットパターンをセットします。
72  	 * 
73  	 * @param timePattern
74  	 *            時刻フォーマットパターン
75  	 */
76  	public void setTimePattern(final String timePattern) {
77  		this.timePattern = timePattern;
78  	}
79  
80  	/**
81  	 * 日付時刻フォーマットパターンを取得します。
82  	 * 
83  	 * @return 日付時刻フォーマットパターン
84  	 */
85  	public String getTimestampPattern() {
86  		return timestampPattern;
87  	}
88  
89  	/**
90  	 * 日付時刻フォーマットパターンをセットします。
91  	 * 
92  	 * @param timestampPattern
93  	 *            日付時刻フォーマットパターン
94  	 */
95  	public void setTimestampPattern(final String timestampPattern) {
96  		this.timestampPattern = timestampPattern;
97  	}
98  
99  	/**
100 	 * このオブジェクトの文字列表現を取得します。
101 	 * 
102 	 * @return このオブジェクトの文字列表現
103 	 */
104 	@Override
105 	public String toString() {
106 		final StringBuilder builder = new StringBuilder();
107 		builder.append(super.toString());
108 		builder.append("[datePattern=");
109 		builder.append(datePattern);
110 		builder.append(",timePattern=");
111 		builder.append(timePattern);
112 		builder.append(",timestampPattern=");
113 		builder.append(timestampPattern);
114 		builder.append("]");
115 		return builder.toString();
116 	}
117 
118 }