Coverage Report - org.org.usurper.handlers.defaults.CharacterPropertyTypeHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
CharacterPropertyTypeHandler
100 %
8/8
N/A
0
 
 1  
 /*
 2  
  ORG Usurper is a random value object generator library 
 3  
  Copyright (C) 2007  Pierre-Antoine GrĂ©goire
 4  
  
 5  
  This library is free software; you can redistribute it and/or
 6  
  modify it under the terms of the GNU Lesser General Public
 7  
  License as published by the Free Software Foundation; either
 8  
  version 2.1 of the License, or (at your option) any later version.
 9  
  
 10  
  This library 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 GNU
 13  
  Lesser General Public License for more details.
 14  
  
 15  
  You should have received a copy of the GNU Lesser General Public
 16  
  License along with this library; if not, write to the Free Software
 17  
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 18  
  */
 19  
 
 20  
 package org.org.usurper.handlers.defaults;
 21  
 
 22  
 import java.util.HashSet;
 23  
 import java.util.Set;
 24  
 
 25  
 import org.org.usurper.handlers.basic.AbstractPropertyTypeHandler;
 26  
 import org.org.usurper.model.HandledBeanProperty;
 27  
 import org.org.usurper.model.HandledConstructorArg;
 28  
 import org.org.usurper.model.PropertyTypeDefinition;
 29  
 import org.org.usurper.utils.RandomUtils;
 30  
 
 31  
 
 32  
 /**
 33  
  * This handler returns a random Character value.<br>
 34  
  * It handles the Character type and the primitive character type.
 35  
  * 
 36  
  * @author pagregoire
 37  
  */
 38  
 public class CharacterPropertyTypeHandler extends AbstractPropertyTypeHandler {
 39  
     
 40  
     /** The handled types. */
 41  
     private static Set<PropertyTypeDefinition> handledTypes;
 42  
     static {
 43  1
         handledTypes = new HashSet<PropertyTypeDefinition>();
 44  1
         handledTypes.add(new PropertyTypeDefinition(Character.class));
 45  1
         handledTypes.add(new PropertyTypeDefinition(char.class));
 46  1
     }
 47  
 
 48  
 
 49  
     /**
 50  
      * Instantiates a new character property type handler.
 51  
      */
 52  
     public CharacterPropertyTypeHandler() {
 53  1
         super(handledTypes);
 54  1
     }
 55  
 
 56  
     /**
 57  
      * Handle.
 58  
      * 
 59  
      * @param handledBeanProperty the handled bean property
 60  
      * 
 61  
      * @return the object
 62  
      * 
 63  
      * @see org.org.zepag.vogenerator.handlers.AbstractPropertyTypeHandler#handle()
 64  
      */
 65  
     public Object handle(HandledBeanProperty handledBeanProperty) {
 66  284
         return RandomUtils.nextCharacter();
 67  
     }
 68  
 
 69  
     /**
 70  
      * Handle.
 71  
      * 
 72  
      * @param handledConstructorArg the handled constructor arg
 73  
      * 
 74  
      * @return the object
 75  
      * 
 76  
      * @see org.org.zepag.vogenerator.handlers.AbstractPropertyTypeHandler#handle()
 77  
      */
 78  
     public Object handle(HandledConstructorArg handledConstructorArg) {
 79  1
         return RandomUtils.nextCharacter();
 80  
     }
 81  
 
 82  
 }