File Source: ExportInfo.java
/*
P/P * Method: com.dmdirc.plugins.ExportInfo__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22 package com.dmdirc.plugins;
23
24 public class ExportInfo {
25 /** Name of class the export is in. */
26 final String className;
27
28 /** Name of method the export is in. */
29 final String methodName;
30
31 /** The PluginInfo that defined this export. */
32 final PluginInfo pluginInfo;
33
34 /**
35 * Create a new ExportInfo.
36 *
37 * @param methodName Name of method the export is in.
38 * @param className Name of class the export is in.
39 * @param pluginInfo The PluginInfo that defined this export.
40 */
/*
P/P * Method: void com.dmdirc.plugins.ExportInfo(String, String, PluginInfo)
*
* Postconditions:
* this.className == className
* init'ed(this.className)
* this.methodName == methodName
* init'ed(this.methodName)
* this.pluginInfo == pluginInfo
* init'ed(this.pluginInfo)
*/
41 public ExportInfo(final String methodName, final String className, final PluginInfo pluginInfo) {
42 this.className = className;
43 this.methodName = methodName;
44 this.pluginInfo = pluginInfo;
45 }
46
47 /**
48 * Get the ExportedService for this Export.
49 *
50 * @return ExportedService object for this export.
51 */
52 public ExportedService getExportedService() {
53 try {
/*
P/P * Method: ExportedService getExportedService()
*
* Preconditions:
* (soft) com/dmdirc/plugins/GlobalClassLoader.me.resourcesList != null
* (soft) com/dmdirc/plugins/GlobalClassLoader.me != null
* (soft) init'ed(this.pluginInfo...myResourceManager)
* (soft) this.className != null
* (soft) this.pluginInfo != null
* (soft) init'ed(this.pluginInfo...metaData)
* (soft) this.pluginInfo...url != null
* (soft) this.pluginInfo.classloader != null
* (soft) this.pluginInfo.classloader.pluginInfo != null
* (soft) init'ed(this.pluginInfo.metaData)
* ...
*
* Postconditions:
* init'ed(com/dmdirc/plugins/GlobalClassLoader.me)
* return_value in Addr_Set{&new ExportedService(getExportedService#1),&new ExportedService(getExportedService#2)}
* init'ed(this.pluginInfo...myResourceManager)
* new ExportedService(getExportedService#1) num objects <= 1
* init'ed(new ExportedService(getExportedService#1).myMethod)
* new ExportedService(getExportedService#1).myObject == One-of{this.pluginInfo.plugin, null}
* init'ed(new ExportedService(getExportedService#1).myObject)
* new ExportedService(getExportedService#2) num objects <= 1
* init'ed(new ExportedService(getExportedService#2).myMethod)
* new ExportedService(getExportedService#2).myObject == null
* ...
*/
54 final Class<?> c = pluginInfo.getPluginClassLoader().loadClass(className, false);
55 final Plugin p = className.equals(pluginInfo.getMainClass()) ? pluginInfo.getPluginObject() : null;
56 return new ExportedService(c, methodName, p);
57 } catch (ClassNotFoundException cnfe) {
58 return new ExportedService(null, null);
59 }
60 }
61 }
SofCheck Inspector Build Version : 2.17854
| ExportInfo.java |
2009-Jun-25 01:54:24 |
| ExportInfo.class |
2009-Sep-02 17:04:13 |