Coverage Report - org.apache.maven.index.Field
 
Classes in this File Line Coverage Branch Coverage Complexity
Field
81 %
13/16
N/A
1
 
 1  
 package org.apache.maven.index;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0    
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.ArrayList;
 23  
 import java.util.Collection;
 24  
 import java.util.Collections;
 25  
 import java.util.List;
 26  
 
 27  
 public class Field
 28  
 {
 29  
     public static final String NOT_PRESENT = "N/P";
 30  
 
 31  
     private final Field parent;
 32  
 
 33  
     private final String namespace;
 34  
 
 35  
     private final String fieldName;
 36  
 
 37  
     private final String description;
 38  
 
 39  
     private final List<IndexerField> indexerFields;
 40  
 
 41  
     public Field( final Field parent, final String namespace, final String name, final String description )
 42  27
     {
 43  27
         this.parent = parent;
 44  
 
 45  27
         this.namespace = namespace;
 46  
 
 47  27
         this.fieldName = name;
 48  
 
 49  27
         this.description = description;
 50  
 
 51  27
         this.indexerFields = new ArrayList<IndexerField>();
 52  27
     }
 53  
 
 54  
     public Field getParent()
 55  
     {
 56  0
         return parent;
 57  
     }
 58  
 
 59  
     public String getNamespace()
 60  
     {
 61  13
         return namespace;
 62  
     }
 63  
 
 64  
     public String getFieldName()
 65  
     {
 66  13
         return fieldName;
 67  
     }
 68  
 
 69  
     public String getDescription()
 70  
     {
 71  0
         return description;
 72  
     }
 73  
 
 74  
     public Collection<IndexerField> getIndexerFields()
 75  
     {
 76  4884
         return Collections.unmodifiableList( indexerFields );
 77  
     }
 78  
 
 79  
     public boolean addIndexerField( IndexerField field )
 80  
     {
 81  29
         return indexerFields.add( field );
 82  
     }
 83  
 
 84  
     public boolean removeIndexerField( IndexerField field )
 85  
     {
 86  0
         return indexerFields.remove( field );
 87  
     }
 88  
 
 89  
     public String getFQN()
 90  
     {
 91  13
         return getNamespace() + getFieldName();
 92  
     }
 93  
 
 94  
     public String toString()
 95  
     {
 96  13
         return getFQN() + " (with " + getIndexerFields().size() + " registered index fields)";
 97  
     }
 98  
 }