Clover coverage report - picocontainer - 1.2-beta-1
Coverage timestamp: Sun May 29 2005 14:29:04 BST
file stats: LOC: 100   Methods: 15
NCLOC: 58   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ImmutablePicoContainer.java 100% 94.1% 93.3% 94.1%
coverage coverage
 1    /*****************************************************************************
 2    * Copyright (C) PicoContainer Organization. All rights reserved. *
 3    * ------------------------------------------------------------------------- *
 4    * The software in this package is published under the terms of the BSD *
 5    * style license a copy of which has been included with this distribution in *
 6    * the LICENSE.txt file. *
 7    * *
 8    * Original code by Paul Hammant *
 9    *****************************************************************************/
 10    package org.picocontainer.alternatives;
 11   
 12    import org.picocontainer.ComponentAdapter;
 13    import org.picocontainer.PicoContainer;
 14    import org.picocontainer.PicoException;
 15    import org.picocontainer.PicoVerificationException;
 16    import org.picocontainer.PicoVisitor;
 17   
 18    import java.io.Serializable;
 19    import java.util.Collection;
 20    import java.util.List;
 21   
 22    // TODO: replace this with a proxy? It don't do nothing! (AH)
 23    // Am open to elegant solution. This, at least, is instantiable (PH)
 24   
 25    /**
 26    * @author Paul Hammant
 27    * @version $Revision: 1731 $
 28    * @since 1.1
 29    */
 30    public class ImmutablePicoContainer implements PicoContainer, Serializable {
 31   
 32    private PicoContainer delegate;
 33   
 34  210 public ImmutablePicoContainer(PicoContainer delegate) {
 35  2 if(delegate == null) throw new NullPointerException("You must pass in a picoContainer instance");
 36  208 this.delegate = delegate;
 37    }
 38   
 39  114 public Object getComponentInstance(Object componentKey) {
 40  114 return delegate.getComponentInstance(componentKey);
 41    }
 42   
 43  2 public Object getComponentInstanceOfType(Class componentType) {
 44  2 return delegate.getComponentInstanceOfType(componentType);
 45    }
 46   
 47  6 public List getComponentInstances() {
 48  6 return delegate.getComponentInstances();
 49    }
 50   
 51  34 public synchronized PicoContainer getParent() {
 52  34 return delegate.getParent();
 53    }
 54   
 55  322 public ComponentAdapter getComponentAdapter(Object componentKey) {
 56  322 return delegate.getComponentAdapter(componentKey);
 57    }
 58   
 59  70 public ComponentAdapter getComponentAdapterOfType(Class componentType) {
 60  70 return delegate.getComponentAdapterOfType(componentType);
 61    }
 62   
 63  28 public Collection getComponentAdapters() {
 64  28 return delegate.getComponentAdapters();
 65    }
 66   
 67  28 public List getComponentAdaptersOfType(Class componentType) {
 68  28 return delegate.getComponentAdaptersOfType(componentType);
 69    }
 70   
 71    /**
 72    * @deprecated since 1.1 - Use new VerifyingVisitor().traverse(this)
 73    */
 74  0 public void verify() throws PicoVerificationException {
 75  0 delegate.verify();
 76    }
 77   
 78  2 public List getComponentInstancesOfType(Class type) throws PicoException {
 79  2 return delegate.getComponentInstancesOfType(type);
 80    }
 81   
 82  4 public void accept(PicoVisitor visitor) {
 83  4 delegate.accept(visitor);
 84    }
 85   
 86  2 public void start() {
 87    // This is false security. As long as components can be accessed with getComponentInstance(), they can also be started. (AH).
 88  2 throw new UnsupportedOperationException("This container is immutable, start() is not allowed");
 89    }
 90   
 91  2 public void stop() {
 92    // This is false security. As long as components can be accessed with getComponentInstance(), they can also be stopped. (AH).
 93  2 throw new UnsupportedOperationException("This container is immutable, stop() is not allowed");
 94    }
 95   
 96  4 public void dispose() {
 97    // This is false security. As long as components can be accessed with getComponentInstance(), they can also be disposed. (AH).
 98  4 throw new UnsupportedOperationException("This container is immutable, dispose() is not allowed");
 99    }
 100    }