Coverage Report - org.dozer.event.DozerEvent
 
Classes in this File Line Coverage Branch Coverage Complexity
DozerEvent
100%
28/28
50%
6/12
1.75
 
 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.event;
 17  
 
 18  
 import org.dozer.classmap.ClassMap;
 19  
 import org.dozer.fieldmap.FieldMap;
 20  
 
 21  
 /**
 22  
  * Public class containing event information.
 23  
  * 
 24  
  * @author garsombke.franz
 25  
  * 
 26  
  */
 27  
 public class DozerEvent {
 28  
 
 29  
   private DozerEventType type;
 30  
   private ClassMap classMap;
 31  
   private FieldMap fieldMap;
 32  
   private Object sourceObject;
 33  
   private Object destinationObject;
 34  
   private Object destinationValue;
 35  
 
 36  
   // TODO Create Object instances only if Event Listeners are registered;
 37  
   public DozerEvent(DozerEventType type, ClassMap classMap, FieldMap fieldMap, Object sourceObject, Object destinationObject,
 38  624100
       Object destinationValue) {
 39  624100
     this.type = type;
 40  624100
     this.classMap = classMap;
 41  624100
     this.fieldMap = fieldMap;
 42  624100
     this.sourceObject = sourceObject;
 43  624100
     this.destinationObject = destinationObject;
 44  624100
     this.destinationValue = destinationValue;
 45  624100
   }
 46  
 
 47  
   public DozerEventType getType() {
 48  624099
     return type;
 49  
   }
 50  
 
 51  
   public ClassMap getClassMap() {
 52  3
     return classMap;
 53  
   }
 54  
 
 55  
   public Object getDestinationObject() {
 56  2
     return destinationObject;
 57  
   }
 58  
 
 59  
   public Object getDestinationValue() {
 60  2
     return destinationValue;
 61  
   }
 62  
 
 63  
   public FieldMap getFieldMap() {
 64  2
     return fieldMap;
 65  
   }
 66  
 
 67  
   public Object getSourceObject() {
 68  2
     return sourceObject;
 69  
   }
 70  
 
 71  
   @Override
 72  
   public String toString() {
 73  1
     StringBuffer sb = new StringBuffer();
 74  1
     if (getClassMap() != null) {
 75  1
       sb.append("Type:").append(type).append("\n");
 76  
     }
 77  1
     if (getClassMap() != null) {
 78  1
       sb.append("ClassMap:").append(getClassMap().toString()).append("\n");
 79  
     }
 80  1
     if (getFieldMap() != null) {
 81  1
       sb.append("FieldMap:").append(getFieldMap().toString()).append("\n");
 82  
     }
 83  1
     if (getSourceObject() != null) {
 84  1
       sb.append("SourceObject:").append(getSourceObject().toString()).append("\n");
 85  
     }
 86  1
     if (getDestinationObject() != null) {
 87  1
       sb.append("DestinationObject:").append(getDestinationObject().toString()).append("\n");
 88  
     }
 89  1
     if (getDestinationValue() != null) {
 90  1
       sb.append("DestinationValue:").append(getDestinationValue().toString()).append("\n");
 91  
     }
 92  1
     return sb.toString();
 93  
   }
 94  
 }