Coverage Report - org.mule.module.json.config.MapperFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
MapperFactoryBean
0%
0/14
0%
0/4
0
 
 1  
 /*
 2  
  * $Id: MapperFactoryBean.java 19715 2010-09-24 15:08:06Z dirk.olmes $
 3  
  * -------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 package org.mule.module.json.config;
 11  
 
 12  
 import java.util.Map;
 13  
 
 14  
 import org.codehaus.jackson.map.ObjectMapper;
 15  
 import org.springframework.beans.factory.config.AbstractFactoryBean;
 16  
 
 17  
 /**
 18  
  * TODO
 19  
  */
 20  0
 public class MapperFactoryBean extends AbstractFactoryBean<ObjectMapper>
 21  
 {
 22  
     private String name;
 23  
     private Map<Class<?>, Class<?>> mixins;
 24  
 
 25  
     @Override
 26  
     public Class<?> getObjectType()
 27  
     {
 28  0
         return ObjectMapper.class;
 29  
     }
 30  
 
 31  
     @Override
 32  
     protected ObjectMapper createInstance() throws Exception
 33  
     {
 34  0
         ObjectMapper mapper = new ObjectMapper();
 35  0
         if(mixins!=null)
 36  
         {
 37  0
             for (Map.Entry<Class<?>, Class<?>> entry : mixins.entrySet())
 38  
             {
 39  0
                 mapper.getSerializationConfig().addMixInAnnotations(entry.getKey(), entry.getValue());
 40  0
                 mapper.getDeserializationConfig().addMixInAnnotations(entry.getKey(), entry.getValue());
 41  
             }
 42  
         }
 43  0
         return mapper;
 44  
     }
 45  
 
 46  
     public Map<Class<?>, Class<?>> getMixins()
 47  
     {
 48  0
         return mixins;
 49  
     }
 50  
 
 51  
     public void setMixins(Map<Class<?>, Class<?>> mixins)
 52  
     {
 53  0
         this.mixins = mixins;
 54  0
     }
 55  
 
 56  
     public String getName()
 57  
     {
 58  0
         return name;
 59  
     }
 60  
 
 61  
     public void setName(String name)
 62  
     {
 63  0
         this.name = name;
 64  0
     }
 65  
 }