001 // Copyright 2004, 2005 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.hivemind.lib.factory;
016
017 import java.util.ArrayList;
018 import java.util.List;
019 import java.util.Map;
020
021 /**
022 * Parameter object passed to {@link org.apache.hivemind.lib.factory.BeanFactoryBuilder}.
023 *
024 * @author Howard Lewis Ship
025 */
026 public class BeanFactoryParameter
027 {
028 private Class _vendClass = Object.class;
029 private boolean _defaultCacheable = true;
030 private List _contributions;
031
032 /**
033 * The contributions to the list (assigned from the companion
034 * configuration point).
035 */
036 public List getContributionsList()
037 {
038 return _contributions;
039 }
040
041 /**
042 * Default value for cacheable in contributions that do not explicitly
043 * set a value. Default is <code>true</code>.
044 */
045
046 public boolean getDefaultCacheable()
047 {
048 return _defaultCacheable;
049 }
050
051 /**
052 * The class or interface to be vended by the factory (all contributed
053 * classes must be assigneble). Defaults to <code>Object</code>.
054 */
055 public Class getVendClass()
056 {
057 return _vendClass;
058 }
059
060 public void setContributions(Map contributions)
061 {
062 _contributions = new ArrayList(contributions.values());
063 }
064
065 public void setContributionsList(List contributions)
066 {
067 _contributions = contributions;
068 }
069
070 public void setDefaultCacheable(boolean b)
071 {
072 _defaultCacheable = b;
073 }
074
075 public void setVendClass(Class class1)
076 {
077 _vendClass = class1;
078 }
079
080 }