librarymodel.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 78 行

JAVA
78
字号
/*
 * $Id: LibraryModel.java,v 1.2 2003/12/21 07:49:02 epr Exp $
 */
package org.jnode.plugin.model;

import java.util.ArrayList;
import java.util.Iterator;

import nanoxml.XMLElement;

import org.jnode.plugin.Library;
import org.jnode.plugin.PluginException;

/**
 * @author epr
 */
public class LibraryModel extends PluginModelObject implements Library {

	private final String name;
	private final String[] exports;
	private final String type;

	/**
	 * @param plugin
	 */
	public LibraryModel(PluginDescriptorModel plugin, XMLElement e) throws PluginException {
		super(plugin);
		name = getAttribute(e, "name", true);
		type = getAttribute(e, "type", false);

		final ArrayList list = new ArrayList();
		for (Iterator i = e.getChildren().iterator(); i.hasNext();) {
			final XMLElement exE = (XMLElement) i.next();
			if (exE.getName().equals("export")) {
				list.add(getAttribute(exE, "name", true));
			}
		}
		exports = (String[]) list.toArray(new String[list.size()]);
	}

	/**
	 * Resolve all references to (elements of) other plugin descriptors
	 * 
	 * @throws PluginException
	 */
	protected void resolve() throws PluginException {
		// Do nothing
	}

	/**
	 * Gets the name of the jar file or directory
	 */
	public String getName() {
		return name;
	}

	/**
	 * Is this a code library?
	 */
	public boolean isCode() {
		return !isResource();
	}

	/**
	 * Is this a resource only library?
	 */
	public boolean isResource() {
		return (type != null) && (type.equals("resource"));
	}

	/**
	 * Gets all declared export names
	 */
	public String[] getExports() {
		return exports;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?