Coverage Report - org.dozer.loader.api.TypeDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
TypeDefinition
50%
18/36
N/A
1
 
 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.BeanFactory;
 19  
 import org.dozer.loader.DozerBuilder;
 20  
 
 21  
 /**
 22  
  * @author Dmitry Buzdin
 23  
  */
 24  
 public class TypeDefinition {
 25  
 
 26  
   private String name;
 27  
   private String beanFactory;
 28  
   private String createMethod;
 29  
   private String factoryBeanId;
 30  
   private Boolean mapEmptyString;
 31  
   private String mapGetMethod;
 32  
   private String mapSetMethod;
 33  
   private Boolean mapNull;
 34  
   private Boolean isAccessible;
 35  
 
 36  57
   public TypeDefinition(Class<?> type) {
 37  57
     this.name = type.getName();
 38  57
   }
 39  
 
 40  1
   public TypeDefinition(String name) {
 41  1
     this.name = name;
 42  1
   }
 43  
 
 44  
   public void build(DozerBuilder.ClassDefinitionBuilder typeBuilder) {
 45  58
     typeBuilder.beanFactory(this.beanFactory);
 46  58
     typeBuilder.createMethod(this.createMethod);
 47  58
     typeBuilder.factoryBeanId(this.factoryBeanId);
 48  
 
 49  58
     typeBuilder.mapEmptyString(this.mapEmptyString);
 50  58
     typeBuilder.mapNull(this.mapNull);
 51  
 
 52  58
     typeBuilder.mapGetMethod(this.mapGetMethod);
 53  58
     typeBuilder.mapSetMethod(this.mapSetMethod);
 54  
 
 55  58
     typeBuilder.isAccessible(this.isAccessible);
 56  58
   }
 57  
 
 58  
   public TypeDefinition mapMethods(String getMethod, String setMethod) {
 59  0
     this.mapGetMethod = getMethod;
 60  0
     this.mapSetMethod = setMethod;
 61  0
     return this;
 62  
   }
 63  
 
 64  
   public TypeDefinition beanFactory(Class<? extends BeanFactory> type) {
 65  0
     this.beanFactory = type.getName();
 66  0
     return this;
 67  
   }
 68  
 
 69  
   public TypeDefinition beanFactory(String name) {
 70  0
     this.beanFactory = name;
 71  0
     return this;
 72  
   }
 73  
 
 74  
   public TypeDefinition createMethod(String method) {
 75  0
     this.createMethod = method;
 76  0
     return this;
 77  
   }
 78  
 
 79  
   public TypeDefinition mapMethods(String factoryBeanId) {
 80  0
     this.factoryBeanId = factoryBeanId;
 81  0
     return this;
 82  
   }
 83  
 
 84  
   public TypeDefinition mapEmptyString() {
 85  0
     return mapEmptyString(true);
 86  
   }
 87  
 
 88  
   public TypeDefinition mapEmptyString(boolean value) {
 89  0
     this.mapEmptyString = value;
 90  0
     return this;
 91  
   }
 92  
 
 93  
   public TypeDefinition mapNull() {
 94  0
     return mapNull(true);
 95  
   }
 96  
 
 97  
   public TypeDefinition mapNull(boolean value) {
 98  1
     this.mapNull = value;
 99  1
     return this;
 100  
   }
 101  
 
 102  
   public TypeDefinition accessible() {
 103  0
     return accessible(true);
 104  
   }
 105  
 
 106  
   public TypeDefinition accessible(boolean value) {
 107  0
     this.isAccessible = value;
 108  0
     return this;
 109  
   }
 110  
 
 111  
   public String getName() {
 112  58
     return name;
 113  
   }
 114  
 
 115  
 }