检查此java项目源代码中的映射变量
我试图理解一个名为Display.java的类中的以下代码:检查此java项目源代码中的映射变量,java,eclipse,debugging,Java,Eclipse,Debugging,我试图理解一个名为Display.java的类中的以下代码: Map<String,Object> context = (Map<String,Object>) globalSession.get("cascadas.ace.context"); if(context != null) { dresscode = (String) context.get("dresscode"); hobby = (String) context.
Map<String,Object> context = (Map<String,Object>) globalSession.get("cascadas.ace.context");
if(context != null) {
dresscode = (String) context.get("dresscode");
hobby = (String) context.get("hobby");
}
if ((hobby == null) || (dresscode == null)) {
SystemConfiguration.getInstance().getLog().warning("Advertisement display: dresscode and/or hobby not available, no image will be displayed.");
}
关于globalSession
变量。。它是一个“会话”对象;在该项目中有一个名为Session
的类,看起来是这样的:
/*
*ACE自主工具包
*(又称CASCADAS ACE工具包)
*
*由CASCADAS项目工作包1创建:
*布达佩斯技术与经济大学
*-弗劳恩霍夫学院
*-意大利电信实验室
*卡塞尔大学
*摩德纳大学和勒佐艾米利亚
*
*有关更多信息,请访问:
*-
*-http://cascadas-project.org
*
*作者要感谢欧盟委员会
*为综合项目CASCADAS Component ware提供资金
*自主、态势感知通信和动态
*适应性服务(FET主动性计划,IST-2004-2.3.4
*位于第六个IST框架内的自主通信)
*节目。作者还希望感谢其他项目合作伙伴的支持
*项目内富有成效的合作。
*/
包cascadas.ace.session;
导入java.io.Serializable;
导入java.util.Map;
/**
*描述会话上下文的接口。
*/
//TODO:对类型安全性内容使用泛型?
公共接口会话扩展了可序列化{
/**
*返回SessionContext的名称。
*
*@返回名称
*/
公共字符串getName();
/**
*从会话中删除键值对。
*@param-key-param-name
*/
公共无效删除(字符串键);
/**
*返回当前状态。
*
*@returncurretn状态
*/
//公共状态getState();
/**
*设置当前状态。
*
*@param是国家
*/
//州政府(s州);
/**
*返回具有指定id的合同。
*
*@param合同id
*@退货合同
*@如果未找到协定,则抛出SessionContextNotFoundException
*/
//公共契约getContract(字符串id)抛出SessionNotFoundException;
/**
*添加具有给定id的合同。id必须唯一。
*
*@param是国家
*/
//公共合同(字符串id,合同c);
/**
*返回所有合同。
*
*@return id-->合同映射
*/
//公共映射getAllContracts();
/**
*将一段数据放入会话上下文。
*用相同的名称覆盖现有数据。
*
*@param id数据的名称
*@param-value数据的值
*/
公共void put(字符串id,对象值)抛出SessionException;
/**
*将整数值放入会话上下文中。
*
*@param id name
*@param值
*/
公共void put(字符串id,int值);
/**
*将双精度值放入会话上下文中。
*
*@param id name
*@param值
*/
公共作废put(字符串id,双值);
/**
*将浮点值放入会话上下文中。
*
*@param id name
*@param值
*/
公共作废put(字符串id、浮点值);
/**
*将长值放入会话上下文中。
*
*@param id name
*@param值
*/
公共作废put(字符串id,长值);
/**
*将短值放入会话上下文中。
*
*@param id name
*@param值
*/
公共void put(字符串id,短值);
/**
*将字符放入会话上下文中。
*
*@param id name
*@param值
*/
公共void put(字符串id、字符值);
/**
*将布尔值放入会话上下文中。
*
*@param id name
*@param值
*/
公共void put(字符串id,布尔值);
/**
*从会话上下文返回匹配的数据。
*
*@param id数据的名称
*@将数据作为对象返回,如果未找到,则返回null
*/
公共对象get(字符串id);
/**
*从会话上下文返回匹配的数据。
*
*@param id数据的名称
*@cascadas.ace.reasoner.SessionContextException
*如果发生错误
*@以整数形式返回数据,如果未找到,则返回0
*/
public int getInt(String id)抛出SessionException;
/**
*从会话上下文返回匹配的数据。
*
*@param id数据的名称
*@cascadas.ace.reasoner.SessionContextException
*如果发生错误
*@以双精度返回数据
*/
public double getDouble(String id)抛出SessionException;
/**
*从会话上下文返回匹配的数据。
*
*@param id数据的名称
*@cascadas.ace.reasoner.SessionContextException
*如果发生错误
*@以浮点形式返回数据
*/
公共float getFloat(字符串id)抛出SessionException;
/**
*从会话上下文返回匹配的数据。
*
*@param id数据的名称
*@cascadas.ace.reasoner.SessionContextException
*如果发生错误
*@将数据作为长字符串返回
*/
public long getLong(String id)抛出SessionException;
/*
Advertisement display: dresscode and/or hobby not available, no image will be displayed."
* - http://cascadas-project.org
*
* The authors would like to acknowledge the European Commission
* for funding the Integrated Project CASCADAS Component-ware for
* Autonomic, Situation-aware Communications, And Dynamically
* Adaptable Services (FET Proactive Initiative, IST-2004-2.3.4
* Situated and Autonomic Communications) within the 6th IST Framework
* Program. The authors also wish to thank other project Partners for
* the fruitful cooperation within the project.
*/
package cascadas.ace.session;
import java.io.Serializable;
import java.util.Map;
/**
* Interface describing the session context.
*/
// TODO: use generics for type safety stuff?
public interface Session extends Serializable {
/**
* Returns the name of the SessionContext.
*
* @return the name
*/
public String getName();
/**
* Removes the key-value pair from the session.
* @param key param name
*/
public void remove(String key);
/**
* Returns the current state.
*
* @return curretn state
*/
// public State getState();
/**
* Sets the current state.
*
* @param s the state
*/
// public void setState(State s);
/**
* Returns the contract with the specified id.
*
* @param contract id
* @return contract
* @throws SessionContextNotFoundException if contract is not found
*/
// public Contract getContract(String id) throws SessionNotFoundException;
/**
* Adds a contract with the given id. Id must be unique.
*
* @param s the state
*/
// public void addContract(String id, Contract c);
/**
* Returns all contracts.
*
* @return id-->contract map
*/
// public Map<String,Contract> getAllContracts();
/**
* Puts a piece of data to the session context.
* Overwrites existing data with teh same name.
*
* @param id name of the data
* @param value value of the data
*/
public void put( String id, Object value ) throws SessionException;
/**
* Puts an integer value into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, int value );
/**
* Puts a double value into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, double value );
/**
* Puts a float into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, float value );
/**
* Puts a long value into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, long value );
/**
* Puts a short value into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, short value );
/**
* Puts a char into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, char value );
/**
* Puts a boolean value into the session context.
*
* @param id name
* @param value value
*/
public void put ( String id, boolean value );
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @return the data as an Object or null if not found
*/
public Object get (String id) ;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as an integer or 0 if not found
*/
public int getInt ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a double
*/
public double getDouble ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a float
*/
public float getFloat ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a long
*/
public long getLong ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a short
*/
public short getShort ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a char
*/
public char getChar ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a boolean
*/
public boolean getBoolean ( String id) throws SessionException;
/**
* Returns the matching data from the session context.
*
* @param id name of the data
* @throws cascadas.ace.reasoner.SessionContextException
* if an error occurs
* @return the data as a String
*/
public String getString ( String id) throws SessionException;
/**
* Returns all data as a set.
* @return all data in the session context
*/
public Map<String,Object> getAllData();
/**
* Sets the ace name (for debug messages).
* @param aceName ace name
*/
public void setAceName(String aceName);
}