KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > lib > factory > BeanFactoryContribution


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 JavaDoc _name;
28     private Class JavaDoc _beanClass;
29     
30     // Stored as a boolean, so that null means 'as defined by the factory'
31
private Boolean JavaDoc _cacheable;
32
33     public Boolean JavaDoc getCacheable()
34     {
35         return _cacheable;
36     }
37
38     public String JavaDoc getName()
39     {
40         return _name;
41     }
42
43     public Class JavaDoc getBeanClass()
44     {
45         return _beanClass;
46     }
47
48     public void setCacheable(Boolean JavaDoc cacheable)
49     {
50         _cacheable = cacheable;
51     }
52
53     public void setName(String JavaDoc string)
54     {
55         _name = string;
56     }
57
58     public void setBeanClass(Class JavaDoc objectClass)
59     {
60         _beanClass = objectClass;
61     }
62
63     public boolean getStoreResultInCache(boolean defaultCacheable)
64     {
65         return _cacheable == null ? defaultCacheable : _cacheable.booleanValue();
66     }
67 }
68
Popular Tags