Coverage Report - be.objectify.led.factory.object.AbstractObjectFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractObjectFactory
100%
6/6
66%
4/6
4
 
 1  
 /*
 2  
  * Copyright 2009-2010 Steve Chaloner
 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 be.objectify.led.factory.object;
 17  
 
 18  
 import be.objectify.led.ObjectFactory;
 19  
 import be.objectify.led.validation.ValidationException;
 20  
 import be.objectify.led.validation.ValidationFunction;
 21  
 
 22  
 /**
 23  
  * @author Steve Chaloner
 24  
  */
 25  1086
 public abstract class AbstractObjectFactory<T> implements ObjectFactory<T>
 26  
 {
 27  
     /**
 28  
      * Default implementation of validate() does nothing.
 29  
      *
 30  
      * @param propertyName the name of the property
 31  
      * @param propertyValue the value from the @{link PropertyContext}
 32  
      * @param validationFunctions functions to validate the property value
 33  
      * @throws ValidationException if the property value isn't valid
 34  
      */
 35  
     public void validate(String propertyName,
 36  
                          String propertyValue,
 37  
                          ValidationFunction... validationFunctions) throws ValidationException
 38  
     {
 39  59
         if (validationFunctions != null)
 40  
         {
 41  59
             for (ValidationFunction validationFunction : validationFunctions)
 42  
             {
 43  2
                 if (validationFunction != null)
 44  
                 {
 45  2
                     validationFunction.validate(propertyName,
 46  
                                                 propertyValue);
 47  
                 }
 48  
             }
 49  
         }
 50  57
     }
 51  
 }