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