Coverage Report - org.dozer.loader.api.FieldDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldDefinition
83%
25/30
100%
2/2
1.091
 
 1  
 /**
 2  
  * Copyright 2005-2013 Dozer Project
 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, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.dozer.loader.api;
 17  
 
 18  
 import org.dozer.loader.DozerBuilder;
 19  
 
 20  
 /**
 21  
  * @author Dmitry Buzdin
 22  
  */
 23  
 public class FieldDefinition {
 24  
 
 25  
   private String value;
 26  
 
 27  
   private Boolean accessible;
 28  
   private String createMethod;
 29  
   private String key;
 30  
   private String mapGetMethod;
 31  
   private String mapSetMethod;
 32  
   private String getMethod;
 33  
   private String setMethod;
 34  
   private boolean iterate;
 35  
 
 36  47
   public FieldDefinition(String value) {
 37  47
     this.value = value;
 38  47
   }
 39  
 
 40  
   public void build(DozerBuilder.FieldDefinitionBuilder builder) {
 41  46
     builder.accessible(this.accessible);
 42  46
     builder.createMethod(this.createMethod);
 43  
 
 44  46
     builder.key(this.key);
 45  46
     builder.mapGetMethod(this.mapGetMethod);
 46  46
     builder.mapSetMethod(this.mapSetMethod);
 47  
 
 48  46
     builder.theGetMethod(this.getMethod);
 49  46
     builder.theSetMethod(this.setMethod);
 50  
 
 51  46
     if (this.iterate) {
 52  1
       builder.iterate();
 53  
     }
 54  46
   }
 55  
 
 56  
   public FieldDefinition iterate() {
 57  1
     this.iterate = true;
 58  1
     return this;
 59  
   }
 60  
 
 61  
   public FieldDefinition accessible() {
 62  0
     return accessible(true);
 63  
   }
 64  
 
 65  
   public FieldDefinition accessible(boolean value) {
 66  4
     this.accessible = value;
 67  4
     return this;
 68  
   }
 69  
 
 70  
   public FieldDefinition createMethod(String method) {
 71  0
     this.createMethod = method;
 72  0
     return this;
 73  
   }
 74  
 
 75  
   public FieldDefinition mapKey(String key) {
 76  2
     this.key = key;
 77  2
     return this;
 78  
   }
 79  
 
 80  
   public FieldDefinition mapMethods(String getMethod, String setMethod) {
 81  2
     this.mapGetMethod = getMethod;
 82  2
     this.mapSetMethod = setMethod;
 83  2
     return this;
 84  
   }
 85  
 
 86  
   public FieldDefinition getMethod(String getMethod) {
 87  0
     this.getMethod = getMethod;
 88  0
     return this;
 89  
   }
 90  
 
 91  
   public FieldDefinition setMethod(String setMethod) {
 92  1
     this.setMethod = setMethod;
 93  1
     return this;
 94  
   }  
 95  
 
 96  
   String resolve() {
 97  48
     return value;
 98  
   }
 99  
 
 100  
 }