Coverage Report - org.seasar.cubby.action.FieldInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldInfo
26%
8/31
0%
0/22
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.action;
 17  
 
 18  
 /**
 19  
  * HTMLフォームにおけるフィールドの情報です。
 20  
  * 
 21  
  * @author baba
 22  
  * @since 1.0.0
 23  
  */
 24  
 public class FieldInfo {
 25  
 
 26  
         /** フィールド名。 */
 27  
         private final String name;
 28  
 
 29  
         /** インデックス。 */
 30  
         private final Integer index;
 31  
 
 32  
         /**
 33  
          * 指定されたフィールド名のフィールドの情報をインスタンス化します。
 34  
          * 
 35  
          * @param name
 36  
          *            フィールド名
 37  
          */
 38  
         public FieldInfo(final String name) {
 39  26
                 this(name, null);
 40  26
         }
 41  
 
 42  
         /**
 43  
          * 指定されたフィールド名とインデックスのフィールドの情報をインスタンス化します。
 44  
          * 
 45  
          * @param name
 46  
          *            フィールド名
 47  
          * @param index
 48  
          *            インデックス
 49  
          */
 50  50
         public FieldInfo(final String name, final Integer index) {
 51  50
                 this.name = name;
 52  50
                 this.index = index;
 53  50
         }
 54  
 
 55  
         /**
 56  
          * フィールド名を取得します。
 57  
          * 
 58  
          * @return フィールド名
 59  
          */
 60  
         public String getName() {
 61  45
                 return name;
 62  
         }
 63  
 
 64  
         /**
 65  
          * インデックスを取得します。
 66  
          * <p>
 67  
          * コンストラクタでインデックスを指定しなかった場合は <code>null</code> を返します。
 68  
          * </p>
 69  
          * 
 70  
          * @return インデックス
 71  
          */
 72  
         public Integer getIndex() {
 73  45
                 return index;
 74  
         }
 75  
 
 76  
         /**
 77  
          * {@inheritDoc}
 78  
          */
 79  
         @Override
 80  
         public int hashCode() {
 81  0
                 final int prime = 31;
 82  0
                 int result = 1;
 83  0
                 result = prime * result + ((index == null) ? 0 : index.hashCode());
 84  0
                 result = prime * result + ((name == null) ? 0 : name.hashCode());
 85  0
                 return result;
 86  
         }
 87  
 
 88  
         /**
 89  
          * {@inheritDoc}
 90  
          */
 91  
         @Override
 92  
         public boolean equals(Object obj) {
 93  0
                 if (this == obj) {
 94  0
                         return true;
 95  
                 }
 96  0
                 if (obj == null) {
 97  0
                         return false;
 98  
                 }
 99  0
                 if (getClass() != obj.getClass()) {
 100  0
                         return false;
 101  
                 }
 102  0
                 FieldInfo other = (FieldInfo) obj;
 103  0
                 if (index == null) {
 104  0
                         if (other.index != null) {
 105  0
                                 return false;
 106  
                         }
 107  0
                 } else if (!index.equals(other.index)) {
 108  0
                         return false;
 109  
                 }
 110  0
                 if (name == null) {
 111  0
                         if (other.name != null) {
 112  0
                                 return false;
 113  
                         }
 114  0
                 } else if (!name.equals(other.name)) {
 115  0
                         return false;
 116  
                 }
 117  0
                 return true;
 118  
         }
 119  
 
 120  
 }