次のエージェントは、ビュー内の列の数と名前を出力します。
import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
View view = db.getView("By Category");
int count = view.getColumnCount();
System.out.println
("¥"By Category¥" has " + count + " columns:");
Vector columnNames = view.getColumnNames();
for (int i=0; i<columnNames.size(); i++) {
System.out.println("¥t#" + new Integer(i+1) + "¥t" +
(String)columnNames.elementAt(i)); }
} catch(Exception e) {
e.printStackTrace();
}
}
}