Browse Source

Made it possible to configure single attributes. This is to help container style tasks.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269094 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
219593398c
2 changed files with 39 additions and 1 deletions
  1. +14
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/Configurer.java
  2. +25
    -1
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java

+ 14
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/Configurer.java View File

@@ -34,4 +34,18 @@ public interface Configurer
*/
void configure( Object object, Configuration configuration, Context context )
throws ConfigurationException;

/**
* Configure named attribute of object in a particular context.
* This configuring can be done in different ways for different
* configurers.
*
* @param object the object
* @param name the attribute name
* @param value the attribute value
* @param context the Context
* @exception ConfigurationException if an error occurs
*/
void configure( Object object, String name, String value, Context context )
throws ConfigurationException;
}

+ 25
- 1
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java View File

@@ -149,6 +149,26 @@ public class DefaultConfigurer
}
}

/**
* Configure named attribute of object in a particular context.
* This configuring can be done in different ways for different
* configurers.
*
* @param object the object
* @param name the attribute name
* @param value the attribute value
* @param context the Context
* @exception ConfigurationException if an error occurs
*/
public void configure( final Object object,
final String name,
final String value,
final Context context )
throws ConfigurationException
{
configureAttribute( object, name, value, context );
}

/**
* Try to configure content of an object.
*
@@ -173,7 +193,11 @@ public class DefaultConfigurer
{
for( int i = 0; i < RESERVED_ATTRIBUTES.length; i++ )
{
if( RESERVED_ATTRIBUTES[ i ].equals( name ) ) return;
if( RESERVED_ATTRIBUTES[ i ].equals( name ) )
{
throw new ConfigurationException( "Can not specify reserved attribute " +
name );
}
}

final String methodName = getMethodNameFor( name );


Loading…
Cancel
Save