You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2008/02/03 06:19:28 UTC

svn commit: r617951 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java

Author: mbenson
Date: Sat Feb  2 21:19:27 2008
New Revision: 617951

URL: http://svn.apache.org/viewvc?rev=617951&view=rev
Log:
javadoc; validate constructor arg

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java?rev=617951&r1=617950&r2=617951&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/KeywordVariables.java Sat Feb  2 21:19:27 2008
@@ -30,26 +30,46 @@
     private String keyword;
     private Object object;
 
+    /**
+     * Create a new KeywordVariables.
+     * @param keyword String
+     * @param object value
+     */
     public KeywordVariables(String keyword, Object object) {
+        if (keyword == null) {
+            throw new IllegalArgumentException("keyword cannot be null");
+        }
         this.keyword = keyword;
         this.object = object;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isDeclaredVariable(String variable) {
         return variable.equals(keyword);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getVariable(String variable) {
         return isDeclaredVariable(variable) ? object : null;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void declareVariable(String variable, Object value) {
         throw new UnsupportedOperationException(
             "Cannot declare new keyword variables.");
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void undeclareVariable(String variable) {
         throw new UnsupportedOperationException(
-            "Cannot declare new keyword variables.");
+            "Cannot undeclare keyword variables.");
     }
 }