Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / util / ImmutableClassPathEntry.java
1 package jde.util;
2
3 import java.io.*;
4 import java.util.*;
5
6 /**
7  * A delegating ClassPathEntry which refuses to clear/reload its
8  * delegate.  Used to wrap bootclasspath entries.  An implementation
9  * of the Decorator pattern.
10  *
11  * Copyright (C) 2001 Eric D. Friedman (eric@hfriedman.rdsl.lmi.net)
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  *
27  * Created: Tuesday Aug 14 19:46:52 2001
28  *
29  * @author Eric D. Friedman
30  * @version $Id: ImmutableClassPathEntry.java,v 1.1 2001/08/15 06:31:27 eric Exp $
31  */
32
33 class ImmutableClassPathEntry extends ClassPathEntry {
34     ClassPathEntry delegate;
35
36     /**
37      * Creates an instance of ImmutableClassPathEntry which delegates
38      * all methods to delegate with the exception of clear/reload
39      * requests.
40      *
41      * @param delegate a <code>ClassPathEntry</code> value
42      * @return an <code>ImmutableClassPathEntry</code> value
43      */
44     ImmutableClassPathEntry (ClassPathEntry delegate){
45         super();
46         this.delegate = delegate;
47     }
48
49     /**
50      * invoke load on the delegate if it isn't already loaded.
51      *
52      * @exception IOException if an error occurs
53      */
54     void load() throws IOException {
55         if (! delegate.isLoaded()) {
56             delegate.load();
57         } // end of if (delegate.isLoaded())
58     }
59
60     /**
61      * no-op
62      *
63      */
64     void clear() {
65         // no-op
66     }
67
68     /**
69      * no-op
70      *
71      * @exception IOException if an error occurs
72      */
73     void reload() {
74         // no-op
75     }
76
77     /**
78      * forwarded to delegate.
79      *
80      * @param unqualifiedName a <code>String</code> value
81      * @return a <code>List</code> value
82      * @exception IOException if an error occurs
83      */
84     List getClassNames(String unqualifiedName)
85         throws IOException {
86         return delegate.getClassNames(unqualifiedName);
87     }
88     
89 }// ImmutableClassPathEntry