Browse Source

Continued the removal of creator cruft

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271742 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
a7fecd5cf9
4 changed files with 11 additions and 43 deletions
  1. +7
    -21
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurationState.java
  2. +2
    -2
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurer.java
  3. +0
    -10
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java
  4. +2
    -10
      proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultPropertyConfigurer.java

+ 7
- 21
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultConfigurationState.java View File

@@ -19,19 +19,17 @@ package org.apache.myrmidon.components.configurer;
class DefaultConfigurationState
implements ConfigurationState
{
private final int[] m_propCount;
private final Object[] m_createdObjects;
private final int[] m_propertyCount;
private final ObjectConfigurer m_configurer;
private final Object m_object;

public DefaultConfigurationState( final ObjectConfigurer configurer,
final Object object,
final int numProps )
final int propertyCount )
{
m_configurer = configurer;
m_object = object;
m_propCount = new int[ numProps ];
m_createdObjects = new Object[ numProps ];
m_propertyCount = new int[ propertyCount ];
}

/**
@@ -49,26 +47,14 @@ class DefaultConfigurationState
}

/** Returns a property count. */
public int getPropCount( final int propIndex )
public int getPropertyCount( final int index )
{
return m_propCount[ propIndex ];
return m_propertyCount[ index ];
}

/** Increments a property count. */
public void incPropCount( final int propIndex )
public void incPropertyCount( final int index )
{
m_propCount[ propIndex ]++;
}

/** Returns a property's pending objects. */
public Object getCreatedObject( final int propIndex )
{
return m_createdObjects[ propIndex ];
}

/** Sets a property's pending objects. */
public void setCreatedObject( final int propIndex, final Object object )
{
m_createdObjects[ propIndex ] = object;
m_propertyCount[ index ]++;
}
}

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

@@ -298,8 +298,8 @@ public class DefaultConfigurer
final String name = element.getName();

// Locate the configurer for the child element
final PropertyConfigurer childConfigurer
= getConfigurerFromName( state.getConfigurer(), name, true );
final PropertyConfigurer childConfigurer =
getConfigurerFromName( state.getConfigurer(), name, true );

// Create & configure the child element
final Object child =


+ 0
- 10
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultObjectConfigurer.java View File

@@ -263,16 +263,6 @@ class DefaultObjectConfigurer
{
// Make sure there are no pending created objects
final DefaultConfigurationState defState = (DefaultConfigurationState)state;
final int size = m_allProps.size();
for( int i = 0; i < size; i++ )
{
if( null != defState.getCreatedObject( i ) )
{
final String message = REZ.getString( "pending-property-value.error" );
throw new ConfigurationException( message );
}
}

return defState.getObject();
}



+ 2
- 10
proposal/myrmidon/src/java/org/apache/myrmidon/components/configurer/DefaultPropertyConfigurer.java View File

@@ -65,21 +65,13 @@ class DefaultPropertyConfigurer
{
final DefaultConfigurationState defState = (DefaultConfigurationState)state;

// Make sure the supplied object is the pending object
final Object pending = defState.getCreatedObject( m_propIndex );
if( pending != null && pending != value )
{
}

defState.setCreatedObject( m_propIndex, null );

// Check the property count
if( defState.getPropCount( m_propIndex ) >= m_maxCount )
if( defState.getPropertyCount( m_propIndex ) >= m_maxCount )
{
final String message = REZ.getString( "too-many-values.error" );
throw new ConfigurationException( message );
}
defState.incPropCount( m_propIndex );
defState.incPropertyCount( m_propIndex );

try
{


Loading…
Cancel
Save