KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > enode > LookupContentFactoryManager


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Nokia. Portions Copyright 2003 Nokia.
17  * All Rights Reserved.
18  */

19
20 package org.netbeans.spi.enode;
21
22 import org.openide.filesystems.FileObject;
23
24 /**
25  * Utility class with a static factory method. The factory
26  * method should be called from the layer.
27  * @author David Strupl
28  */

29 public final class LookupContentFactoryManager {
30
31     /**
32      * No instances of this class should be created.
33      */

34     private LookupContentFactoryManager() {
35     }
36
37     /**
38      * This method is intended to be called from the layer
39      * by means of the methodvalue file attribute. <UL>The following
40      * attributes of the file object are examined:
41      * <LI><EM>"implements"</EM> - comma delimited list of interfaces/classes
42      * that the resulting object implements. These are the
43      * only classes that are examined when someone asks the
44      * lookup</LI>
45      * <LI><EM>"factoryClass"</EM> - class on which the method <code>newInstance</code>
46      * is called to create the resulting object or lookup</LI></UL>
47      * @param FileObject must be from the system file system
48      * @return LookupContentFactory usually wrapped in an utility wrapper
49      * that is used for passing the node argument in methods of LookupContentFactory
50      * and also as a performance optimalization in following sense: the class
51      * specified by the "factoryClass" attribute is not loaded until
52      * someone calls a lookup with argument containing a class from the list
53      * specified in the "implements" list
54      */

55     public static LookupContentFactory create(FileObject f) {
56         return new org.netbeans.modules.enode.FactoryWrapper(f);
57     }
58     
59 }
60
Popular Tags