commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans PropertyOwnerPointer.java NullPointer.java NullElementPointer.java DynamicPointer.java BeanPointer.java
Date Thu, 11 Jul 2002 01:17:16 GMT
dmitri      2002/07/10 18:17:16

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/model/beans
                        PropertyOwnerPointer.java NullPointer.java
                        NullElementPointer.java DynamicPointer.java
                        BeanPointer.java
  Log:
  Unified the setValue method
  
  Revision  Changes    Path
  1.6       +19 -4     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
  
  Index: PropertyOwnerPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PropertyOwnerPointer.java	18 Jun 2002 00:01:15 -0000	1.5
  +++ PropertyOwnerPointer.java	11 Jul 2002 01:17:16 -0000	1.6
  @@ -149,8 +149,23 @@
       }
   
       public abstract QName getName();
  +
       public void setValue(Object value){
           this.value = value;
  +        if (parent != null){
  +            if (!parent.isNode()){
  +                parent.setValue(value);
  +            }
  +            else {
  +                throw new UnsupportedOperationException(
  +                  "Cannot setValue of an object that is not " +
  +                  "some other object's property");
  +            }
  +        }
  +        else {
  +            throw new UnsupportedOperationException(
  +              "Cannot replace the root object");
  +        }
       }
   
       public abstract PropertyPointer getPropertyPointer();
  
  
  
  1.5       +4 -14     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java
  
  Index: NullPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/NullPointer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NullPointer.java	8 Jun 2002 22:47:24 -0000	1.4
  +++ NullPointer.java	11 Jul 2002 01:17:16 -0000	1.5
  @@ -101,16 +101,6 @@
           return null;
       }
   
  -    public void setValue(Object value){
  -        super.setValue(value);
  -        if (parent instanceof PropertyPointer){
  -            parent.setValue(value);
  -        }
  -        else {
  -            throw new UnsupportedOperationException("Cannot setValue of an object that
is not some other object's property/child");
  -        }
  -    }
  -
       public boolean isActual(){
           return false;
       }
  
  
  
  1.6       +4 -14     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java
  
  Index: NullElementPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/NullElementPointer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NullElementPointer.java	8 May 2002 23:05:05 -0000	1.5
  +++ NullElementPointer.java	11 Jul 2002 01:17:16 -0000	1.6
  @@ -106,16 +106,6 @@
           return new NullPointer(this, getName());
       }
   
  -    public void setValue(Object value){
  -        super.setValue(value);
  -        if (parent instanceof PropertyPointer){
  -            parent.setValue(value);
  -        }
  -        else {
  -            throw new UnsupportedOperationException("Cannot setValue of an object that
is not some other object's property");
  -        }
  -    }
  -
       public boolean isActual(){
           return false;
       }
  
  
  
  1.4       +4 -11     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPointer.java
  
  Index: DynamicPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/DynamicPointer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DynamicPointer.java	30 May 2002 02:04:57 -0000	1.3
  +++ DynamicPointer.java	11 Jul 2002 01:17:16 -0000	1.4
  @@ -111,13 +111,6 @@
       }
   
       /**
  -     * Throws UnsupportedOperationException.
  -     */
  -    public void setValue(Object value){
  -        throw new UnsupportedOperationException("Cannot replace the root object");
  -    }
  -
  -    /**
        * If the bean is a collection, returns the length of that collection,
        * otherwise returns 1.
        */
  
  
  
  1.5       +4 -17     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java
  
  Index: BeanPointer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/beans/BeanPointer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BeanPointer.java	29 May 2002 00:40:58 -0000	1.4
  +++ BeanPointer.java	11 Jul 2002 01:17:16 -0000	1.5
  @@ -115,19 +115,6 @@
           return bean;
       }
   
  -    /**
  -     * Throws an exception if you try to change the root element.
  -     */
  -    public void setValue(Object value){
  -        super.setValue(value);
  -        if (parent instanceof PropertyPointer){
  -            parent.setValue(value);
  -        }
  -        else {
  -            throw new UnsupportedOperationException("Cannot setValue of an object that
is not some other object's property");
  -        }
  -    }
  -
       public void remove(){
           super.setValue(null);
           if (parent != null){
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message