CommandMap (Java EE 5)

Java EE API


javax.activation Class CommandMap

java.lang.Object
  extended by javax.activation.CommandMap
Direct Known Subclasses:
MailcapCommandMap

public abstract class CommandMap
extends Object

Extended by: MailcapCommandMap

CommandMap 类为系统中可用的命令对象注册表提供接口。期望开发人员使用此包 (MailcapCommandMap) 所包含的 CommandMap 实现,或者开发他们自己的实现。注意,此类中有些方法是抽象的。
英文文档:

The CommandMap class provides an interface to a registry of command objects available in the system. Developers are expected to either use the CommandMap implementation included with this package (MailcapCommandMap) or develop their own. Note that some of the methods in this class are abstract.


Constructor Summary
 
Method Summary
abstract  DataContentHandler
 DataContentHandler
abstract  CommandInfo[]
 CommandInfo[]
abstract  CommandInfo
 CommandInfo
static CommandMap
 String[]
abstract  CommandInfo[]
 CommandInfo[]
static void
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public CommandMap()
英文文档:

CommandMap

public CommandMap()
Method Detail

public static CommandMap getDefaultCommandMap()
获取默认的 CommandMap。

  • 在 CommandMap 实例已经被设置为某值(通过setDefaultCommandMap)的情况下,返回该 CommandMap。
  • 在没有设置任何 CommandMap 的情况下,CommandMap 创建一个 MailcapCommandMap 的实例并将其设置为默认值,返回它的值。
return CommandMap
英文文档:

getDefaultCommandMap

public static CommandMap getDefaultCommandMap()
Get the default CommandMap.

  • In cases where a CommandMap instance has been previously set to some value (via setDefaultCommandMap) return the CommandMap.
  • In cases where no CommandMap has been set, the CommandMap creates an instance of MailcapCommandMap and set that to the default, returning its value.

Returns:
the CommandMap

public static void setDefaultCommandMap(CommandMap commandMap)
设置默认的 CommandMap。通过用 null 调用此方法将 CommandMap 重置为默认值。
commandMap 新的默认 CommandMap。
ThrowsSecurityException: 如果调用者不具有更改默认的权限
英文文档:

setDefaultCommandMap

public static void setDefaultCommandMap(CommandMap commandMap)
Set the default CommandMap. Reset the CommandMap to the default by calling this method with null.

Parameters:
commandMap - The new default CommandMap.
Throws:
SecurityException - if the caller doesn't have permission to change the default

abstract public CommandInfo[] getPreferredCommands(String mimeType)
从 MIME 类型获取首选命令表。实际语义由 CommandMap 的实现来确定。
mimeType MIME 类型
return 表示命令 Bean 的 CommandInfo 类
英文文档:

getPreferredCommands

public abstract CommandInfo[] getPreferredCommands(String mimeType)
Get the preferred command list from a MIME Type. The actual semantics are determined by the implementation of the CommandMap.

Parameters:
mimeType - the MIME type
Returns:
the CommandInfo classes that represent the command Beans.

public CommandInfo[] getPreferredCommands(String mimeType, DataSource ds)
从 MIME 类型获取首选命令表。实际语义由 CommandMap 的实现来确定。

DataSource 提供额外信息,比如文件名,CommandMap 实现可以使用它进一步改进返回的命令表。此类中的实现调用 getPreferredCommands 方法,忽略此参数。

mimeType MIME 类型
ds 数据的 DataSource
return 表示命令 Bean 的 CommandInfo 类
sinceJAF 1.1

英文文档:

getPreferredCommands

public CommandInfo[] getPreferredCommands(String mimeType,
                                          DataSource ds)
Get the preferred command list from a MIME Type. The actual semantics are determined by the implementation of the CommandMap.

The DataSource provides extra information, such as the file name, that a CommandMap implementation may use to further refine the list of commands that are returned. The implementation in this class simply calls the getPreferredCommands method that ignores this argument.

Parameters:
mimeType - the MIME type
ds - a DataSource for the data
Returns:
the CommandInfo classes that represent the command Beans.
Since:
JAF 1.1

abstract public CommandInfo[] getAllCommands(String mimeType)
获取此类型的所有可用命令。此方法应该返回此 MIME 类型的所有可能命令。
mimeType MIME 类型
return 表示所有命令的 CommandInfo 对象
英文文档:

getAllCommands

public abstract CommandInfo[] getAllCommands(String mimeType)
Get all the available commands for this type. This method should return all the possible commands for this MIME type.

Parameters:
mimeType - the MIME type
Returns:
the CommandInfo objects representing all the commands.

public CommandInfo[] getAllCommands(String mimeType, DataSource ds)
获取此类型的所有可用命令。此方法应该返回此 MIME 类型的所有可能命令。

DataSource 提供额外信息,比如文件名,CommandMap 实现可以使用它进一步改进返回的命令表。此类中的实现调用 getAllCommands 方法,忽略此参数。

mimeType MIME 类型
ds 数据的 DataSource
return 表示所有命令的 CommandInfo 对象
sinceJAF 1.1

英文文档:

getAllCommands

public CommandInfo[] getAllCommands(String mimeType,
                                    DataSource ds)
Get all the available commands for this type. This method should return all the possible commands for this MIME type.

The DataSource provides extra information, such as the file name, that a CommandMap implementation may use to further refine the list of commands that are returned. The implementation in this class simply calls the getAllCommands method that ignores this argument.

Parameters:
mimeType - the MIME type
ds - a DataSource for the data
Returns:
the CommandInfo objects representing all the commands.
Since:
JAF 1.1

abstract public CommandInfo getCommand(String mimeType, String cmdName)
获取与 MIME 类型对应的默认命令。
mimeType MIME 类型
cmdName 命令名
return 与命令对应的 CommandInfo
英文文档:

getCommand

public abstract CommandInfo getCommand(String mimeType,
                                       String cmdName)
Get the default command corresponding to the MIME type.

Parameters:
mimeType - the MIME type
cmdName - the command name
Returns:
the CommandInfo corresponding to the command.

public CommandInfo getCommand(String mimeType, String cmdName, DataSource ds)
获取与 MIME 类型对应的默认命令。

DataSource 提供额外信息,比如文件名,CommandMap 实现可以使用它进一步改进选择的命令。此类中的实现调用 getCommand 方法,忽略此参数。

mimeType MIME 类型
cmdName 命令名
ds 数据的 DataSource
return 与命令对应的 CommandInfo
sinceJAF 1.1

英文文档:

getCommand

public CommandInfo getCommand(String mimeType,
                              String cmdName,
                              DataSource ds)
Get the default command corresponding to the MIME type.

The DataSource provides extra information, such as the file name, that a CommandMap implementation may use to further refine the command that is chosen. The implementation in this class simply calls the getCommand method that ignores this argument.

Parameters:
mimeType - the MIME type
cmdName - the command name
ds - a DataSource for the data
Returns:
the CommandInfo corresponding to the command.
Since:
JAF 1.1

abstract public DataContentHandler createDataContentHandler(String mimeType)
查找与 MIME 类型对应的 DataContentHandler。确定它的机制和语义由特定 CommandMap 的实现确定。
mimeType MIME 类型
return MIME 类型的 DataContentHandler
英文文档:

createDataContentHandler

public abstract DataContentHandler createDataContentHandler(String mimeType)
Locate a DataContentHandler that corresponds to the MIME type. The mechanism and semantics for determining this are determined by the implementation of the particular CommandMap.

Parameters:
mimeType - the MIME type
Returns:
the DataContentHandler for the MIME type

public DataContentHandler createDataContentHandler(String mimeType, DataSource ds)
查找与 MIME 类型对应的 DataContentHandler。确定它的机制和语义由特定 CommandMap 的实现确定。

DataSource 提供额外信息,比如文件名称,CommandMap 实现可以使用它进一步改进 DataContentHandler 的选择。此类中的实现调用 createDataContentHandler 方法,忽略此参数。

mimeType MIME 类型
ds 数据的 DataSource
return MIME 类型的 DataContentHandler
sinceJAF 1.1

英文文档:

createDataContentHandler

public DataContentHandler createDataContentHandler(String mimeType,
                                                   DataSource ds)
Locate a DataContentHandler that corresponds to the MIME type. The mechanism and semantics for determining this are determined by the implementation of the particular CommandMap.

The DataSource provides extra information, such as the file name, that a CommandMap implementation may use to further refine the choice of DataContentHandler. The implementation in this class simply calls the createDataContentHandler method that ignores this argument.

Parameters:
mimeType - the MIME type
ds - a DataSource for the data
Returns:
the DataContentHandler for the MIME type
Since:
JAF 1.1

public String[] getMimeTypes()
获取此命令映射已知的所有 MIME 类型。如果命令映射不支持此操作,则返回 null。
return 以字符串形式返回 MIME 类型数组;如果不支持,则返回 null
sinceJAF 1.1
英文文档:

getMimeTypes

public String[] getMimeTypes()
Get all the MIME types known to this command map. If the command map doesn't support this operation, null is returned.

Returns:
array of MIME types as strings, or null if not supported
Since:
JAF 1.1


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!