KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > databinding > datagrid > api > DataGridConfigFactory


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.databinding.datagrid.api;
19
20 import org.apache.beehive.netui.databinding.datagrid.runtime.config.DefaultDataGridConfig;
21 import org.apache.beehive.netui.databinding.datagrid.runtime.util.ExtensionUtil;
22
23 /**
24  * <p>
25  * A factory for creating instances of a {@link DataGridConfig}.
26  * </p>
27  */

28 public final class DataGridConfigFactory {
29
30     private static final DataGridConfig DEFAULT_DATA_GRID_CONFIG = new DefaultDataGridConfig();
31     /* do not construct */
32     private DataGridConfigFactory() {
33     }
34
35     /**
36      * Create an instance of the default {@link DataGridConfig} object. When no other configuration
37      * information is available, clients can use this method to create an instance that
38      * provides sufficient defaults for data grid rendering.
39      *
40      * @return the default data grid config object.
41      */

42     public static final DataGridConfig getInstance() {
43         return DEFAULT_DATA_GRID_CONFIG;
44     }
45
46     /**
47      * Create an instance of a {@link DataGridConfig} object given a {@link Class} object.
48      * The given class must extend the {@link DataGridConfig} base class.
49      *
50      * @param clazz the class to instantiate
51      * @return the new {@link DataGridConfig} instance
52      */

53     public static final DataGridConfig getInstance(Class JavaDoc clazz) {
54         DataGridConfig config = (DataGridConfig)ExtensionUtil.instantiateClass(clazz, DataGridConfig.class);
55         return config;
56     }
57 }
58
Popular Tags