| 
  |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| BeanFactoryContribution.java | 100% | 85.7% | 85.7% | 87.5% | 
             | 
  ||||||||||||||
| 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.lib.factory; | |
| 16 | ||
| 17 | import org.apache.hivemind.impl.BaseLocatable; | |
| 18 | ||
| 19 | /** | |
| 20 | * A contribution used with an {@link org.apache.hivemind.lib.BeanFactory} | |
| 21 | * to define one class of objects that may be returned from the factory. | |
| 22 | * | |
| 23 | * @author Howard Lewis Ship | |
| 24 | */ | |
| 25 | public class BeanFactoryContribution extends BaseLocatable | |
| 26 | { | |
| 27 | private String _name; | |
| 28 | private Class _beanClass; | |
| 29 | ||
| 30 | // Stored as a boolean, so that null means 'as defined by the factory' | |
| 31 | private Boolean _cacheable; | |
| 32 | ||
| 33 | 0 | public Boolean getCacheable() | 
| 34 | { | |
| 35 | 0 | return _cacheable; | 
| 36 | } | |
| 37 | ||
| 38 | 13 | public String getName() | 
| 39 | { | |
| 40 | 13 | return _name; | 
| 41 | } | |
| 42 | ||
| 43 | 25 | public Class getBeanClass() | 
| 44 | { | |
| 45 | 25 | return _beanClass; | 
| 46 | } | |
| 47 | ||
| 48 | 11 | public void setCacheable(Boolean cacheable) | 
| 49 | { | |
| 50 | 11 | _cacheable = cacheable; | 
| 51 | } | |
| 52 | ||
| 53 | 13 | public void setName(String string) | 
| 54 | { | |
| 55 | 13 | _name = string; | 
| 56 | } | |
| 57 | ||
| 58 | 13 | public void setBeanClass(Class objectClass) | 
| 59 | { | |
| 60 | 13 | _beanClass = objectClass; | 
| 61 | } | |
| 62 | ||
| 63 | 7 | public boolean getStoreResultInCache(boolean defaultCacheable) | 
| 64 | { | |
| 65 | 7 | return _cacheable == null ? defaultCacheable : _cacheable.booleanValue(); | 
| 66 | } | |
| 67 | } | 
  | 
||||||||||