JavaTM 2 Platform
Standard Ed. 5.0

org.omg.CORBA
类 ContextList

java.lang.Object
  继承者 org.omg.CORBA.ContextList

public abstract class ContextList
extends Object

一个对象,它包含表示属性名称的 String 对象所组成的可修改列表。此类在 Request 操作中使用,用于描述需要解析并与调用一起发送的上下文。(上下文是通过给定属性名称并取回与之关联的值来解析的。)这通过调用 Context 方法 get_values 并提供取自 ContextList 对象的字符串作为第三个参数来实现。get_values 方法返回一个包含 NamedValue 对象的 NVList 对象,NamedValue 保存由给定字符串标识的值。

ContextList 对象由 ORB 创建,如下所示:

   ORB orb = ORB.init(args, null);
   org.omg.CORBA.ContextList ctxList = orb.create_context_list();
 
变量 ctxList 表示空 ContextList 对象。使用方法 add 将 String 添加到列表中,使用方法 item 访问,使用方法 remove 删除。

从以下版本开始:
JDK1.2
另请参见:
Context

构造方法摘要
ContextList()
           
 
方法摘要
abstract  void add(String ctx)
          将 String 对象添加到此 ContextList 对象中。
abstract  int count()
          返回此 ContextList 对象中的 String 对象数。
abstract  String item(int index)
          返回位于给定索引的 String 对象。
abstract  void remove(int index)
          移除给定索引处的 String 对象。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ContextList

public ContextList()
方法详细信息

count

public abstract int count()
返回此 ContextList 对象中的 String 对象数。

返回:
表示此 ContextList 对象中 String 数量的 int

add

public abstract void add(String ctx)
String 对象添加到此 ContextList 对象中。

参数:
ctx - 要添加的 String 对象

item

public abstract String item(int index)
                     throws Bounds
返回位于给定索引的 String 对象。

参数:
index - 所需字符串的索引,其中 0 为第一个字符串的索引
返回:
给定索引处的字符串
抛出:
Bounds - 如果索引大于或等于此 ContextList 对象中的字符串数

remove

public abstract void remove(int index)
                     throws Bounds
移除给定索引处的 String 对象。注意,被移除对象后面的所有字符串的索引都向下移动一位。

参数:
index - 将要移除的 String 对象的索引,0 表示第一个字符串
抛出:
Bounds - 如果该索引大于或等于此 ContextList 对象中的 String 对象数

JavaTM 2 Platform
Standard Ed. 5.0

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策