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
015package org.apache.hivemind.lib.factory;
016
017import org.apache.hivemind.impl.BaseLocatable;
018
019/**
020 * A contribution used with an {@link org.apache.hivemind.lib.BeanFactory}
021 * to define one class of objects that may be returned from the factory.
022 *
023 * @author Howard Lewis Ship
024 */
025public class BeanFactoryContribution extends BaseLocatable
026{
027    private String _name;
028    private Class _beanClass;
029    
030    // Stored as a boolean, so that null means 'as defined by the factory'
031    private Boolean _cacheable;
032
033    public Boolean getCacheable()
034    {
035        return _cacheable;
036    }
037
038    public String getName()
039    {
040        return _name;
041    }
042
043    public Class getBeanClass()
044    {
045        return _beanClass;
046    }
047
048    public void setCacheable(Boolean cacheable)
049    {
050        _cacheable = cacheable;
051    }
052
053    public void setName(String string)
054    {
055        _name = string;
056    }
057
058    public void setBeanClass(Class objectClass)
059    {
060        _beanClass = objectClass;
061    }
062
063    public boolean getStoreResultInCache(boolean defaultCacheable)
064    {
065        return _cacheable == null ? defaultCacheable : _cacheable.booleanValue();
066    }
067}