Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6647/src/java/net/sf/asterisk/manager/response
Modified Files:
ManagerResponse.java
Log Message:
Added javadoc to attribute retrieval methods
Index: ManagerResponse.java
===================================================================
RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response/ManagerResponse.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -p -r1.4 -r1.5
--- ManagerResponse.java 23 Apr 2005 22:56:33 -0000 1.4
+++ ManagerResponse.java 24 Apr 2005 13:39:40 -0000 1.5
@@ -45,16 +45,48 @@ public class ManagerResponse implements
private String uniqueId;
private Map attributes;
+ /**
+ * Returns a Map with all attributes of this response.<br>
+ * The keys are all lower case!
+ * @see #getAttribute(String)
+ */
public Map getAttributes()
{
return attributes;
}
+ /**
+ * Sets the Map with all attributes.
+ * @param attributes Map with containing the attributes with all lower
+ * case keys.
+ */
public void setAttributes(Map attributes)
{
this.attributes = attributes;
}
+ /**
+ * Returns the value of the attribute with the given key.<br>
+ * This is particulary important when a response contains special
+ * attributes that are dependent on the action that has been sent.<br>
+ * An example of this is the response to the GetVarAction.
+ * It contains the value of the channel variable as an attribute
+ * stored under the key of the variable name.<br>
+ * Example:
+ * <pre>
+ * GetVarAction action = new GetVarAction();
+ * action.setChannel("SIP/1310-22c3");
+ * action.setVariable("ALERT_INFO");
+ * ManagerResponse response = connection.sendAction(action);
+ * String alertInfo = response.getAttribute("ALERT_INFO");
+ * </pre>
+ * As all attributes are internally stored in lower case the key is
+ * automatically converted to lower case before lookup.
+ *
+ * @param key the key to lookup.
+ * @return the value of the attribute stored under this key or
+ * <code>null</code> if there is no such attribute.
+ */
public String getAttribute(String key)
{
return (String) attributes.get(key.toLowerCase());
|