Coverage Report - org.jtheque.primary.utils.web.analyzers.generic.field.DisabledFieldGetterFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
DisabledFieldGetterFactory
0 %
0/4
N/A
1
DisabledFieldGetterFactory$1
N/A
N/A
1
DisabledFieldGetterFactory$DisabledFieldGetter
0 %
0/8
N/A
1
 
 1  
 package org.jtheque.primary.utils.web.analyzers.generic.field;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *            
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License. 
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jdom.Element;
 20  
 import org.jtheque.core.utils.file.XMLException;
 21  
 import org.jtheque.core.utils.file.XMLReader;
 22  
 import org.jtheque.primary.utils.web.analyzers.generic.Factory;
 23  
 import org.jtheque.primary.utils.web.analyzers.generic.operation.ScannerPossessor;
 24  
 
 25  
 /**
 26  
  * @author Baptiste Wicht
 27  
  */
 28  0
 final class DisabledFieldGetterFactory implements Factory<FieldGetter> {
 29  
         @Override
 30  
         public boolean canFactor(Element element, XMLReader reader) throws XMLException{
 31  0
                 return "true".equals(reader.readString("@disabled", element));
 32  
         }
 33  
 
 34  
         @Override
 35  
         public FieldGetter factor(Element element, XMLReader reader) throws XMLException{
 36  0
                 return new DisabledFieldGetter(reader.readString("@field", element));
 37  
         }
 38  
 
 39  
         /**
 40  
          * A disabled field getter. It seems a field getter who never read a line.
 41  
          *
 42  
          * @author Baptiste Wicht
 43  
          */
 44  0
         private static final class DisabledFieldGetter implements FieldGetter {
 45  
                 private final String fieldName;
 46  
 
 47  
                 /**
 48  
                  * Construct a new DisabledFieldGetter.
 49  
                  *
 50  
                  * @param fieldName The name of the field.
 51  
                  */
 52  0
                 private DisabledFieldGetter(String fieldName){
 53  0
                         this.fieldName = fieldName;
 54  0
                 }
 55  
 
 56  
                 @Override
 57  
                 public String getFieldName(){
 58  0
                         return fieldName;
 59  
                 }
 60  
 
 61  
                 @Override
 62  
                 public boolean mustGet(String line){
 63  0
                         return false;
 64  
                 }
 65  
 
 66  
                 @Override
 67  
                 public String getValue(String line){
 68  0
                         return null;
 69  
                 }
 70  
 
 71  
                 @Override
 72  
                 public String performOperations(String line, ScannerPossessor analyzer){
 73  0
                         return null;
 74  
                 }
 75  
         }
 76  
 }