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