ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/extension ExtensionAdapter.java
Date Tue, 30 Apr 2002 03:17:53 GMT
donaldp     02/04/29 20:17:53

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/extension
                        ExtensionAdapter.java
  Log:
  Make sure can not set attributes if is a reference datatype
  
  add a nicer toString method
  
  Revision  Changes    Path
  1.2       +22 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
  
  Index: ExtensionAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtensionAdapter.java	18 Apr 2002 12:57:06 -0000	1.1
  +++ ExtensionAdapter.java	30 Apr 2002 03:17:53 -0000	1.2
  @@ -62,7 +62,7 @@
    * patterns.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/18 12:57:06 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/30 03:17:53 $
    * @ant.data-type name="extension"
    */
   public class ExtensionAdapter
  @@ -116,6 +116,7 @@
        */
       public void setExtensionName( final String extensionName )
       {
  +        verifyNotAReference();
           m_extensionName = extensionName;
       }
   
  @@ -126,6 +127,7 @@
        */
       public void setSpecificationVersion( final String specificationVersion )
       {
  +        verifyNotAReference();
           m_specificationVersion = new DeweyDecimal( specificationVersion );
       }
   
  @@ -136,6 +138,7 @@
        */
       public void setSpecificationVendor( final String specificationVendor )
       {
  +        verifyNotAReference();
           m_specificationVendor = specificationVendor;
       }
   
  @@ -146,6 +149,7 @@
        */
       public void setImplementationVendorId( final String implementationVendorID )
       {
  +        verifyNotAReference();
           m_implementationVendorID = implementationVendorID;
       }
   
  @@ -156,6 +160,7 @@
        */
       public void setImplementationVendor( final String implementationVendor )
       {
  +        verifyNotAReference();
           m_implementationVendor = implementationVendor;
       }
   
  @@ -166,6 +171,7 @@
        */
       public void setImplementationVersion( final String implementationVersion )
       {
  +        verifyNotAReference();
           m_implementationVersion = new DeweyDecimal( implementationVersion );
       }
   
  @@ -176,6 +182,7 @@
        */
       public void setImplementationUrl( final String implementationURL )
       {
  +        verifyNotAReference();
           m_implementationURL = implementationURL;
       }
   
  @@ -225,6 +232,15 @@
           super.setRefid( reference );
       }
   
  +    private void verifyNotAReference()
  +        throws BuildException
  +    {
  +        if( isReference() )
  +        {
  +            throw tooManyAttributes();
  +        }
  +    }
  +
       /**
        * Convert this adpater object into an extension object.
        *
  @@ -256,5 +272,10 @@
                                 m_implementationVendorID,
                                 m_implementationVendor,
                                 m_implementationURL );
  +    }
  +
  +    public String toString()
  +    {
  +        return toExtension().toString();
       }
   }
  
  
  

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


Mime
View raw message