xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile Both2Bind.java TypeMatcher.java
Date Fri, 16 Apr 2004 18:31:12 GMT
pcal        2004/04/16 11:31:12

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/compile
                        Both2Bind.java TypeMatcher.java
  Log:
  b2b: add facility for specifying isSetters
  
  Revision  Changes    Path
  1.13      +3 -0      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Both2Bind.java
  
  Index: Both2Bind.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Both2Bind.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Both2Bind.java	8 Apr 2004 20:01:01 -0000	1.12
  +++ Both2Bind.java	16 Apr 2004 18:31:12 -0000	1.13
  @@ -23,6 +23,7 @@
   import org.apache.xmlbeans.impl.binding.tylar.TylarWriter;
   import org.apache.xmlbeans.impl.jam.JClass;
   import org.apache.xmlbeans.impl.jam.JProperty;
  +import org.apache.xmlbeans.impl.jam.JMethod;
   
   import javax.xml.namespace.QName;
   import java.io.IOException;
  @@ -591,6 +592,8 @@
         prop.setAttribute(sProp.isAttribute());
         prop.setSetterName(MethodName.create(jProp.getSetter()));
         prop.setGetterName(MethodName.create(jProp.getGetter()));
  +      JMethod isSetter = matchedProperties[i].getIsSetter();
  +      if (isSetter != null) prop.setIssetterName(MethodName.create(isSetter));
         prop.setCollectionClass(collection);
         prop.setBindingType(bType);
         prop.setNillable(sProp.hasNillable() != SchemaProperty.NEVER);
  
  
  
  1.8       +30 -1     xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/TypeMatcher.java
  
  Index: TypeMatcher.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/TypeMatcher.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TypeMatcher.java	7 Apr 2004 23:20:02 -0000	1.7
  +++ TypeMatcher.java	16 Apr 2004 18:31:12 -0000	1.8
  @@ -17,6 +17,7 @@
   
   import org.apache.xmlbeans.impl.jam.JClass;
   import org.apache.xmlbeans.impl.jam.JProperty;
  +import org.apache.xmlbeans.impl.jam.JMethod;
   import org.apache.xmlbeans.SchemaType;
   import org.apache.xmlbeans.SchemaProperty;
   import org.apache.xmlbeans.SchemaTypeSystem;
  @@ -107,13 +108,35 @@
       {
           private JProperty jProperty;
           private SchemaProperty sProperty;
  +        private JMethod isSetter = null;
   
           public MatchedProperties(JProperty jProperty, SchemaProperty sProperty)
           {
  +            this(jProperty,sProperty,null);
  +        }
  +
  +        public MatchedProperties(JProperty jProperty,
  +                                 SchemaProperty sProperty,
  +                                 JMethod isSetter)
  +        {
               this.jProperty = jProperty;
               this.sProperty = sProperty;
  +            if (isSetter != null) {
  +              if (isSetter.getParameters().length > 0) {
  +                throw new IllegalArgumentException
  +                  ("an isSetter method must take no parameters ('"+
  +                   isSetter.getQualifiedName()+"')");
  +              }
  +              if (!isSetter.getReturnType().getQualifiedName().
  +                equals("boolean")) {
  +                throw new IllegalArgumentException
  +                  ("an isSetter method must return 'boolean' ('"+
  +                   isSetter.getQualifiedName()+"')");
  +              }
  +            }
  +            this.isSetter = isSetter;
           }
  -
  +      
           public JProperty getJProperty()
           {
               return jProperty;
  @@ -123,6 +146,12 @@
           {
               return sProperty;
           }
  +
  +        public JMethod getIsSetter()
  +        {
  +            return isSetter;
  +        }
  +
       }
       
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message