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-myrmidon/container/src/java/org/apache/myrmidon/components/configurer DefaultObjectConfigurer.java Resources.properties
Date Thu, 25 Apr 2002 02:55:41 GMT
donaldp     02/04/24 19:55:41

  Modified:    container/src/java/org/apache/myrmidon/components/configurer
                        DefaultObjectConfigurer.java Resources.properties
  Log:
  Make sure typed adders only take interfaces. Looks like I nuked it in recent ModelElement
move. As ModelElement is not a interface at this stage, treat it specially (it was special
cased later anyways).
  
  Revision  Changes    Path
  1.23      +11 -1     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java
  
  Index: DefaultObjectConfigurer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- DefaultObjectConfigurer.java	23 Apr 2002 06:22:40 -0000	1.22
  +++ DefaultObjectConfigurer.java	25 Apr 2002 02:55:41 -0000	1.23
  @@ -18,13 +18,14 @@
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.metadata.ModelException;
  +import org.apache.myrmidon.api.metadata.ModelElement;
   
   /**
    * An object configurer which uses reflection to determine the properties
    * of a class.
    *
    * @author <a href="mailto:adammurdoch_ml@yahoo.com">Adam Murdoch</a>
  - * @version $Revision: 1.22 $ $Date: 2002/04/23 06:22:40 $
  + * @version $Revision: 1.23 $ $Date: 2002/04/25 02:55:41 $
    */
   class DefaultObjectConfigurer
       implements ObjectConfigurer
  @@ -154,6 +155,15 @@
   
           final Method method = (Method)methods.iterator().next();
           final Class type = method.getParameterTypes()[ 0 ];
  +
  +        if( !type.isInterface() && ModelElement.class != type )
  +        {
  +            final String message =
  +                REZ.getString( "typed-adder-non-interface.error",
  +                               m_class.getName(),
  +                               type.getName() );
  +            throw new ModelException( message );
  +        }
   
           m_typedPropertyConfigurer
               = new DefaultPropertyConfigurer( getPropertyCount(),
  
  
  
  1.20      +2 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/configurer/Resources.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Resources.properties	23 Apr 2002 06:22:40 -0000	1.19
  +++ Resources.properties	25 Apr 2002 02:55:41 -0000	1.20
  @@ -13,4 +13,5 @@
   bad-set-content.error=Could not set text content for element <{0}>.
   create-typed-object.error=Could not create an object of type "{0}" of class {1}.
   unknown-reference.error=Could not find referenced object "{0}".
  -bad-configure-element.error=Could not configure element <{0}>.
  \ No newline at end of file
  +bad-configure-element.error=Could not configure element <{0}>.
  +typed-adder-non-interface.error=The typed adder for class "{0}" must have a single parameter
that is an interface (or of type ModelElement) rather than {1} which defines a class.
  
  
  

--
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