2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Clover coverage report - Code Coverage for hivemind release 1.2.1
Coverage timestamp: Fri Feb 10 2006 16:33:43 PST
file stats: LOC: 134   Methods: 13
NCLOC: 85   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BuilderParameter.java 83.3% 100% 100% 97.5%
coverage coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.hivemind.service.impl;
 16   
 17    import java.util.ArrayList;
 18    import java.util.HashMap;
 19    import java.util.Iterator;
 20    import java.util.List;
 21    import java.util.Map;
 22   
 23    import org.apache.hivemind.ServiceImplementationFactoryParameters;
 24    import org.apache.hivemind.impl.BaseLocatable;
 25   
 26    /**
 27    * Parameter object used with {@link org.apache.hivemind.service.impl.BuilderFactory}.
 28    *
 29    * @author Howard Lewis Ship
 30    */
 31    public class BuilderParameter extends BaseLocatable
 32    {
 33    private String _className;
 34   
 35    private List _properties = new ArrayList();
 36   
 37    private List _parameters = new ArrayList();
 38   
 39    /** @since 1.1 */
 40    private Map _typeFacetMap = new HashMap();
 41   
 42    private List _events = new ArrayList();
 43   
 44    private String _initializeMethod;
 45   
 46    private boolean _autowireServices;
 47   
 48  790 public String getClassName()
 49    {
 50  790 return _className;
 51    }
 52   
 53  46 public void addParameter(BuilderFacet facet)
 54    {
 55  46 _parameters.add(facet);
 56    }
 57   
 58  790 public List getParameters()
 59    {
 60  790 return _parameters;
 61    }
 62   
 63  3314 public void addProperty(BuilderFacet facet)
 64    {
 65  3314 _properties.add(facet);
 66    }
 67   
 68  789 public List getProperties()
 69    {
 70  789 return _properties;
 71    }
 72   
 73    /** @since 1.1 */
 74  11 public BuilderFacet getFacetForType(ServiceImplementationFactoryParameters factoryParameters,
 75    Class targetType)
 76    {
 77  11 BuilderFacet result = (BuilderFacet) _typeFacetMap.get(targetType);
 78   
 79  11 if (result == null)
 80    {
 81  11 for (Iterator i = _properties.iterator(); i.hasNext();)
 82    {
 83  30 BuilderFacet facet = (BuilderFacet) i.next();
 84   
 85  30 if (facet.canAutowireConstructorParameter()
 86    && facet.isAssignableToType(factoryParameters, targetType))
 87    {
 88  3 result = facet;
 89  3 break;
 90    }
 91    }
 92   
 93  11 _typeFacetMap.put(targetType, result);
 94    }
 95   
 96  11 return result;
 97    }
 98   
 99  490 public void setClassName(String string)
 100    {
 101  490 _className = string;
 102    }
 103   
 104  3 public void addEventRegistration(EventRegistration registration)
 105    {
 106  3 _events.add(registration);
 107    }
 108   
 109  789 public List getEventRegistrations()
 110    {
 111  789 return _events;
 112    }
 113   
 114  789 public String getInitializeMethod()
 115    {
 116  789 return _initializeMethod;
 117    }
 118   
 119  6 public void setInitializeMethod(String string)
 120    {
 121  6 _initializeMethod = string;
 122    }
 123   
 124  1579 public boolean getAutowireServices()
 125    {
 126  1579 return _autowireServices;
 127    }
 128   
 129  486 public void setAutowireServices(boolean autowireServices)
 130    {
 131  486 _autowireServices = autowireServices;
 132    }
 133   
 134    }