You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dm...@apache.org on 2002/05/09 01:02:42 UTC

cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath Variables.java BasicVariables.java

dmitri      02/05/08 16:02:42

  Modified:    jxpath/src/java/org/apache/commons/jxpath Variables.java
                        BasicVariables.java
  Log:
  Added "undeclareVariable"
  
  Revision  Changes    Path
  1.3       +16 -10    jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/Variables.java
  
  Index: Variables.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/Variables.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Variables.java	24 Apr 2002 03:30:17 -0000	1.2
  +++ Variables.java	8 May 2002 23:02:42 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/Variables.java,v 1.2 2002/04/24 03:30:17 dmitri Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/04/24 03:30:17 $
  + * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/Variables.java,v 1.3 2002/05/08 23:02:42 dmitri Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/08 23:02:42 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -63,14 +63,12 @@
   
   /**
    * Variables provide access to a global set of values accessible via XPath.
  - * XPath can reference variables using the "$varname" syntax. To use a custom
  - * implementation of this interface, pass it to a newContext method of
  - * JXPathContext.
  - *
  - * @see JXPathContext#setVariables
  + * XPath can reference variables using the <code>"$varname"</code> syntax.
  + * To use a custom implementation of this interface, pass it to
  + * {@link JXPathContext#setVariables JXPathContext.setVariables()}
    *
    * @author Dmitri Plotnikov
  - * @version $Revision: 1.2 $ $Date: 2002/04/24 03:30:17 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/08 23:02:42 $
    */
   public interface Variables {
   
  @@ -87,7 +85,15 @@
   
       /**
        * Defines a new variable with the specified value or modifies
  -     * the value of an existing variable. May throw UnsupportedOperationException.
  +     * the value of an existing variable.
  +     * May throw UnsupportedOperationException.
        */
       void declareVariable(String varName, Object value);
  +
  +    /**
  +     * Removes an existing variable. May throw UnsupportedOperationException.
  +     *
  +     * @param varName is a variable name without the "$" sign
  +     */
  +    void undeclareVariable(String varName);
   }
  
  
  
  1.3       +17 -9     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/BasicVariables.java
  
  Index: BasicVariables.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/BasicVariables.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BasicVariables.java	24 Apr 2002 03:29:33 -0000	1.2
  +++ BasicVariables.java	8 May 2002 23:02:42 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/BasicVariables.java,v 1.2 2002/04/24 03:29:33 dmitri Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/04/24 03:29:33 $
  + * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/BasicVariables.java,v 1.3 2002/05/08 23:02:42 dmitri Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/08 23:02:42 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -67,7 +67,7 @@
    * A basic implementation of the Variables interface that uses a HashMap.
    *
    * @author Dmitri Plotnikov
  - * @version $Revision: 1.2 $ $Date: 2002/04/24 03:29:33 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/08 23:02:42 $
    */
   public class BasicVariables implements Variables {
   
  @@ -79,9 +79,9 @@
       /**
        * Returns true if the variable has been defined, even if the
        * value of the variable is null.
  -     * 
  +     *
        * @param varName is a variable name without the "$" sign
  -     * 
  +     *
        * @return true if the variable is declared
        */
       public boolean isDeclaredVariable(String varName){
  @@ -91,9 +91,9 @@
       /**
        * Returns the value of the variable if it is defined,
        * otherwise, throws IllegalArgumentException
  -     * 
  +     *
        * @param varName is a variable name without the "$" sign
  -     * 
  +     *
        * @return the value of the variable
        */
       public Object getVariable(String varName){
  @@ -109,7 +109,7 @@
       /**
        * Defines a new variable with the specified value or modifies
        * the value of an existing variable.
  -     * 
  +     *
        * @param varName is a variable name without the "$" sign
        * @param value is the new value for the variable, which can be null
        */
  @@ -117,6 +117,14 @@
           vars.put(varName, value);
       }
   
  +    /**
  +     * Removes an existing variable. May throw UnsupportedOperationException.
  +     *
  +     * @param varName is a variable name without the "$" sign
  +     */
  +    public void undeclareVariable(String varName){
  +        vars.remove(varName);
  +    }
       public String toString(){
           return vars.toString();
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>