You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by hl...@apache.org on 2003/08/11 17:19:51 UTC
cvs commit: jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse ExtensionDescriptor.java
hlship 2003/08/11 08:19:51
Modified: hivemind/src/java/org/apache/commons/hivemind
HiveMindMessages.properties
hivemind/src/java/org/apache/commons/hivemind/impl
ExtensionImpl.java
hivemind/src/java/org/apache/commons/hivemind/service/impl
AbstractServiceInterceptorFactory.java
ClassFactoryImpl.java ClassFabImpl.java
LoggingInterceptorFactory.java
hivemind/src/test/hivemind/test HiveMindSuite.java
hivemind/src/java/org/apache/commons/hivemind/parse
ExtensionDescriptor.java
Added: hivemind/src/java/org/apache/commons/hivemind/service/impl
ClassFabUtils.java
hivemind/src/test/hivemind/test TestMisc.java
PrivateBean.java
Log:
Fill in some minor gaps in the code coverage.
Revision Changes Path
1.22 +2 -2 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties
Index: HiveMindMessages.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- HiveMindMessages.properties 8 Aug 2003 13:51:08 -0000 1.21
+++ HiveMindMessages.properties 11 Aug 2003 15:19:50 -0000 1.22
@@ -7,7 +7,7 @@
no-such-service=Service {0} (implementing interface {1}) does not exist.
unable-to-set-property=Unable to set property {0} of {1} to {2}: {3}
-wrong-factory-parameter-count=Service implementation factory {0} expects {1,choice,0#no parameters|1#one parameter,1<{1,number,integer} parameters} but received {2,choice,0#none|1#one|1<{2,number,integer}}.
+wrong-factory-parameter-count=Service implementation factory {0} expects {1,choice,0#no parameters|1#one parameter|1<{1,number,integer} parameters} but received {2,choice,0#none|1#one|1<{2,number,integer}}.
HiveMind.default-registry-not-set=HiveMind.getDefault() invoked before default registry has been set.
HiveMind.elements-not-orderable=Elements of list {0} do not implement the Orderable interface and can not be sorted.
1.3 +1 -9 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ExtensionImpl.java
Index: ExtensionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ExtensionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExtensionImpl.java 5 Aug 2003 17:16:29 -0000 1.2
+++ ExtensionImpl.java 11 Aug 2003 15:19:50 -0000 1.3
@@ -88,14 +88,6 @@
_contributingModule = module;
}
- public void addElement(Element element)
- {
- if (_elements == null)
- _elements = new ArrayList();
-
- _elements.add(element);
- }
-
public void addElements(List elements)
{
if (_elements == null)
1.8 +1 -17 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/AbstractServiceInterceptorFactory.java
Index: AbstractServiceInterceptorFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/AbstractServiceInterceptorFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractServiceInterceptorFactory.java 8 Aug 2003 13:51:10 -0000 1.7
+++ AbstractServiceInterceptorFactory.java 11 Aug 2003 15:19:51 -0000 1.8
@@ -260,20 +260,4 @@
fab.addMethod("toString", String.class, null, null, body.toString());
}
-
- /**
- * Convienience for converting a class into a proper name, compatibile
- * with {@link org.apache.commons.hivemind.service.MethodFab}. It is important
- * that array types be converted properly, for array types,
- * getName() returns the incorrect value, but this method
- * returns the correct value.
- *
- */
- protected String getClassName(Class inputClass)
- {
- if (inputClass.isArray())
- return getClassName(inputClass.getComponentType()) + "[]";
-
- return inputClass.getName();
- }
}
1.5 +4 -18 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/ClassFactoryImpl.java
Index: ClassFactoryImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/ClassFactoryImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClassFactoryImpl.java 8 Aug 2003 13:51:10 -0000 1.4
+++ ClassFactoryImpl.java 11 Aug 2003 15:19:51 -0000 1.5
@@ -112,8 +112,8 @@
public CtClass getClass(ClassPool pool, Class inputClass)
{
- String name = getName(inputClass);
-
+ String name = ClassFabUtils.getJavaClassName(inputClass);
+
try
{
return pool.get(name);
@@ -149,7 +149,7 @@
{
String id = module.getModuleId();
- ClassPool result = (ClassPool)_poolMap.get(id);
+ ClassPool result = (ClassPool) _poolMap.get(id);
if (result == null)
{
@@ -167,18 +167,4 @@
return result;
}
- /**
- * Javassist needs the class name to be as it appears in code, even for arrays.
- * Invoking getName() on Class instance representing an array returns the itnernal
- * format (i.e, "[...;" or something). This returns it as it would appear in
- * Java code.
- *
- */
- private String getName(Class inputClass)
- {
- if (inputClass.isArray())
- return getName(inputClass.getComponentType()) + "[]";
-
- return inputClass.getName();
- }
}
1.4 +7 -0 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/ClassFabImpl.java
Index: ClassFabImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/ClassFabImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ClassFabImpl.java 8 Aug 2003 13:51:10 -0000 1.3
+++ ClassFabImpl.java 11 Aug 2003 15:19:51 -0000 1.4
@@ -69,6 +69,13 @@
import org.apache.commons.hivemind.service.ClassFab;
import org.apache.commons.hivemind.service.MethodFab;
+/**
+ * Implementation of {@link org.apache.commons.hivemind.service.ClassFab}. Hides,
+ * as much as possible, the underlying library (Javassist).
+ *
+ * @author Howard Lewis Ship
+ * @version $Id$
+ */
public class ClassFabImpl implements ClassFab
{
private ClassFactoryImpl _factory;
1.5 +2 -3 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/LoggingInterceptorFactory.java
Index: LoggingInterceptorFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/LoggingInterceptorFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LoggingInterceptorFactory.java 5 Aug 2003 22:06:58 -0000 1.4
+++ LoggingInterceptorFactory.java 11 Aug 2003 15:19:51 -0000 1.5
@@ -116,8 +116,7 @@
if (!isVoid)
{
- // May need work, for arrays and such.
- buffer.append(getClassName(returnType));
+ buffer.append(ClassFabUtils.getJavaClassName(returnType));
buffer.append(" result = ");
}
1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/ClassFabUtils.java
Index: ClassFabUtils.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.hivemind.service.impl;
/**
* Static class containing utility methods.
*
* @author Howard Lewis Ship
* @version $Id: ClassFabUtils.java,v 1.1 2003/08/11 15:19:51 hlship Exp $
*/
public class ClassFabUtils
{
private ClassFabUtils()
{
}
/**
* Javassist needs the class name to be as it appears in code, even for arrays.
* Invoking getName() on Class instance representing an array returns the itnernal
* format (i.e, "[...;" or something). This returns it as it would appear in
* Java code.
*
*/
public static String getJavaClassName(Class inputClass)
{
if (inputClass.isArray())
return getJavaClassName(inputClass.getComponentType()) + "[]";
return inputClass.getName();
}
}
1.15 +4 -2 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/HiveMindSuite.java
Index: HiveMindSuite.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/HiveMindSuite.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- HiveMindSuite.java 10 Aug 2003 19:54:54 -0000 1.14
+++ HiveMindSuite.java 11 Aug 2003 15:19:51 -0000 1.15
@@ -83,7 +83,7 @@
TestSuite suite = new TestSuite("Master HiveMind Test Suite");
suite.addTestSuite(TestLocation.class);
-
+
suite.addTestSuite(TestLocalizedNameGenerator.class);
suite.addTestSuite(TestHiveMindFindLocation.class);
@@ -117,6 +117,8 @@
suite.addTestSuite(TestExtensionPointTranslator.class);
suite.addTestSuite(TestInvokeParentRule.class);
+
+ suite.addTestSuite(TestMisc.class);
return suite;
}
1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/TestMisc.java
Index: TestMisc.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package hivemind.test;
import hivemind.test.rules.MockModule;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.commons.hivemind.ApplicationRuntimeException;
import org.apache.commons.hivemind.HiveMind;
import org.apache.commons.hivemind.Module;
import org.apache.commons.hivemind.Registry;
import org.apache.commons.hivemind.ServiceExtensionPoint;
import org.apache.commons.hivemind.impl.CreateClassServiceConstructor;
import org.apache.commons.hivemind.impl.ExtensionImpl;
import org.apache.commons.hivemind.impl.InvokeFactoryServiceConstructor;
import org.apache.commons.hivemind.impl.ModuleImpl;
import org.apache.commons.hivemind.impl.RegistryImpl;
import org.apache.commons.hivemind.impl.ServiceExtensionPointImpl;
import org.apache.commons.hivemind.service.RemoteExceptionEvent;
/**
* Additional tests to fill in minor code coverage gaps.
*
* @author Howard Lewis Ship
* @version $Id: TestMisc.java,v 1.1 2003/08/11 15:19:51 hlship Exp $
*/
public class TestMisc extends HiveMindTestCase
{
public TestMisc(String name)
{
super(name);
}
public void testRemoteExceptionEvent()
{
Throwable t = new RuntimeException();
RemoteExceptionEvent ev = new RemoteExceptionEvent(this, t);
assertSame(this, ev.getSource());
assertSame(t, ev.getException());
}
public void testHiveMindGetDefault()
{
assertEquals(false, HiveMind.isInitialized());
try
{
HiveMind.getDefault();
unreachable();
}
catch (ApplicationRuntimeException ex)
{
checkException(
ex,
"HiveMind.getDefault() invoked before default registry has been set.");
}
}
public void testHiveMindSetDefault()
{
Registry r = new RegistryImpl(Locale.getDefault());
HiveMind.setDefault(r);
assertSame(r, HiveMind.getDefault());
assertEquals(true, HiveMind.isInitialized());
}
public void testCheckFactoryParameterCountFailure()
{
try
{
HiveMind.checkFactoryParameterCount("an.extension.id", new ArrayList(), 1);
unreachable();
}
catch (ApplicationRuntimeException ex)
{
checkException(
ex,
"Service implementation factory an.extension.id expects one parameter but received none.");
}
}
public void testSortOrderablesFailure()
{
List l = new ArrayList();
l.add("alpha");
l.add("beta");
try
{
HiveMind.sortOrderables(l);
unreachable();
}
catch (ApplicationRuntimeException ex)
{
checkException(
ex,
"Elements of list [alpha, beta] do not implement the Orderable interface and can not be sorted.");
}
}
public void testSortOrderablesEmpty()
{
List l = new ArrayList();
List o = HiveMind.sortOrderables(l);
assertSame(Collections.EMPTY_LIST, o);
}
public void testGetMessage()
{
assertEquals(
"Service {0} (implementing interface {1}) does not exist.",
HiveMind.getMessage("no-such-service"));
}
public void testGetMessageFailure()
{
assertEquals("[UNKNOWN-KEY]", HiveMind.getMessage("unknown-key"));
}
public void testApplicationRuntimeExceptionGetComponent()
{
ApplicationRuntimeException ex =
new ApplicationRuntimeException("My Message", this, null, null);
assertSame(this, ex.getComponent());
}
public void testApplicationRuntimeExceptionThrowableConstructor()
{
RuntimeException re = new RuntimeException("Now it can be told.");
ApplicationRuntimeException ex = new ApplicationRuntimeException(re);
assertEquals("Now it can be told.", ex.getMessage());
assertSame(re, ex.getRootCause());
}
public void testExtensionImplGetElementsEmpty()
{
ExtensionImpl e = new ExtensionImpl();
assertSame(Collections.EMPTY_LIST, e.getElements());
}
public void testInvokeFactoryServiceConstructorAccessors()
{
Module m = new ModuleImpl();
ServiceExtensionPoint sep = new ServiceExtensionPointImpl();
List p = new ArrayList();
InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor();
c.setContributingModule(m);
c.setServiceExtensionPoint(sep);
c.setParameters(p);
assertSame(m, c.getContributingModule());
assertSame(sep, c.getServiceExtensionPoint());
assertSame(p, c.getParameters());
}
public void testCreateClassServiceConstructorAccessors()
{
Module m = new MockModule();
CreateClassServiceConstructor c = new CreateClassServiceConstructor();
c.setContributingModule(m);
assertSame(m, c.getContributingModule());
c.setInstanceClassName("java.util.HashMap");
assertEquals("java.util.HashMap", c.getInstanceClassName());
}
public void testCreateClassServiceConstructorTwice()
{
Module m = new MockModule();
CreateClassServiceConstructor c = new CreateClassServiceConstructor();
c.setContributingModule(m);
c.setInstanceClassName("java.util.HashMap");
Object o1 = c.constructCoreServiceImplementation();
Object o2 = c.constructCoreServiceImplementation();
assertNotSame(o1, o2);
assertTrue(o1 instanceof HashMap);
assertTrue(o2 instanceof HashMap);
}
public void testCreateClassServiceConstructorFailure()
{
Module m = new MockModule();
CreateClassServiceConstructor c = new CreateClassServiceConstructor();
c.setContributingModule(m);
c.setInstanceClassName(PrivateBean.class.getName());
try
{
c.constructCoreServiceImplementation();
unreachable();
}
catch (Exception ex)
{
checkException(
ex,
"Unable to create an instance of class hivemind.test.PrivateBean: "
+ "Class org.apache.commons.hivemind.impl.CreateClassServiceConstructor can not access a member of class hivemind.test.PrivateBean with modifiers \"private\"");
}
}
}
1.1 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/PrivateBean.java
Index: PrivateBean.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package hivemind.test;
/**
* Used when testing {@link org.apache.commons.hivemind.impl.CreateClassServiceConstructor}
* as a bean which can't be instantiated.
*
* @author Howard Lewis Ship
* @version $Id: PrivateBean.java,v 1.1 2003/08/11 15:19:51 hlship Exp $
*/
public class PrivateBean
{
private PrivateBean()
{
}
}
1.3 +11 -16 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ExtensionDescriptor.java
Index: ExtensionDescriptor.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ExtensionDescriptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExtensionDescriptor.java 8 Aug 2003 13:51:09 -0000 1.2
+++ ExtensionDescriptor.java 11 Aug 2003 15:19:51 -0000 1.3
@@ -77,10 +77,10 @@
private List _elements;
- /**
- * Returns the extension id, which may be a local id (simple name)
- * or an extended id (including a module id prefix).
- */
+ /**
+ * Returns the extension id, which may be a local id (simple name)
+ * or an extended id (including a module id prefix).
+ */
public String getPointId()
{
return _pointId;
@@ -91,32 +91,27 @@
_pointId = string;
}
- protected void extendDescription(ToStringBuilder builder)
+ public String toString()
{
+ ToStringBuilder builder = new ToStringBuilder(this);
builder.append("pointId", _pointId);
+
+ return builder.toString();
}
public void addElement(Element element)
{
if (_elements == null)
_elements = new ArrayList();
-
- _elements.add(element);
- }
- public void addElements(List elements)
- {
- if (_elements == null)
- _elements = new ArrayList(elements);
- else
- _elements.addAll(elements);
+ _elements.add(element);
}
public List getElements()
{
if (_elements == null)
return Collections.EMPTY_LIST;
-
+
return _elements;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org