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