You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/03/17 01:34:38 UTC

svn commit: r924074 [1/6] - in /wicket/trunk: testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/ wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/ wicket-guice/src/test/java/org/apac...

Author: ivaynberg
Date: Wed Mar 17 00:34:34 2010
New Revision: 924074

URL: http://svn.apache.org/viewvc?rev=924074&view=rev
Log:
first pass on factoring out wicket-util. the next step is factoring out wicket-request. over the years the code has become extremely tangled and impossible to maintain. this is an attempt to untangle and decouple different sections of code in the hopes of making ongoing maintenance easier.

Added:
    wicket/trunk/wicket-util/   (with props)
    wicket/trunk/wicket-util/.settings/
    wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs   (with props)
    wicket/trunk/wicket-util/pom.xml   (with props)
    wicket/trunk/wicket-util/src/
    wicket/trunk/wicket-util/src/main/
    wicket/trunk/wicket-util/src/main/java/
    wicket/trunk/wicket-util/src/main/java/org/
    wicket/trunk/wicket-util/src/main/java/org/apache/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/IConverter.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/BooleanGroup.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/FloatingPointGroup.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/Group.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/GroupAlreadyBoundException.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/GroupNotBoundException.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/IntegerGroup.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/MetaPattern.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/OptionalMetaPattern.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/package.html
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/CommaSeparatedVariableParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/IntegerVariableAssignmentParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/ListParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/MetaPatternParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/TagNameParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/VariableAssignmentParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/WordParser.java
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/package.html
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AbstractStringList.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/IStringIterator.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/IStringSequence.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/PrependingStringBuffer.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringList.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/StringValueConversionException.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/string/package.html   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/thread/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/thread/ICode.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/thread/Lock.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/thread/Task.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/thread/package.html   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/AbstractTime.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/AbstractTimeValue.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Duration.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/ITimeFrameSource.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/TimeFrame.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/TimeMap.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/TimeOfDay.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/package.html   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/AttributeMap.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/CopyOnWriteValueMap.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/Count.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/IValueMap.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/IntValue.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/LongValue.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/ValueMap.java   (with props)
    wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/value/package.html   (with props)
    wicket/trunk/wicket-util/src/test/
    wicket/trunk/wicket-util/src/test/java/
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/WicketObjects.java   (with props)
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/ComponentStrings.java   (with props)
Removed:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/IClusterable.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/convert/ConversionException.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/convert/IConverter.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/convert/MaskConverter.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Generics.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Objects.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/PackageName.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Packages.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/lang/Primitives.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/BooleanGroup.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/FloatingPointGroup.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/Group.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/GroupAlreadyBoundException.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/GroupNotBoundException.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/IntegerGroup.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/MetaPattern.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/OptionalMetaPattern.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/package.html
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/CommaSeparatedVariableParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/IntegerVariableAssignmentParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/ListParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/MetaPatternParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/TagNameParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/VariableAssignmentParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/WordParser.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/parse/metapattern/parsers/package.html
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/AbstractStringList.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/AppendingStringBuffer.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/IStringIterator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/IStringSequence.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/PrependingStringBuffer.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/StringList.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/StringValue.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/StringValueConversionException.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/string/Strings.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/thread/ICode.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/thread/Lock.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/thread/Task.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/thread/package.html
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/AbstractTime.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/AbstractTimeValue.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Duration.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/ITimeFrameSource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/TimeFrame.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/TimeOfDay.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/package.html
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/AttributeMap.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/CopyOnWriteValueMap.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/Count.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/IValueMap.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/IntValue.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/LongValue.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/package.html
Modified:
    wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java
    wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
    wicket/trunk/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java
    wicket/trunk/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java
    wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java
    wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/ObjectSizeOfAgent.java
    wicket/trunk/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java
    wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
    wicket/trunk/wicket/pom.xml
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Page.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/model/Model.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/pageStore/DefaultPageStore.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/util/lang/ObjectsTest.java

Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java Wed Mar 17 00:34:34 2010
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.wicket.threadtest.tester.SimpleGetCommand;
 import org.apache.wicket.threadtest.tester.Tester;
 import org.apache.wicket.util.io.WicketObjectStreamFactory;
-import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.WicketObjects;
 
 /**
  * @author eelcohillenius
@@ -50,7 +50,7 @@ public class App1Test1
 		// you can turn this on if you e.g. want to attach to a profiler
 		// Thread.sleep(5000);
 
-		Objects.setObjectStreamFactory(new WicketObjectStreamFactory());
+		WicketObjects.setObjectStreamFactory(new WicketObjectStreamFactory());
 		SimpleGetCommand getCmd = new SimpleGetCommand(gets, 10);
 		// getCmd.setPrintResponse(true);
 		Tester tester = new Tester(getCmd, 100, true);

Modified: wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java (original)
+++ wicket/trunk/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/GoAndClearFilter.java Wed Mar 17 00:34:34 2010
@@ -20,7 +20,7 @@ import org.apache.wicket.markup.html.for
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.WicketObjects;
 
 /**
  * Filter component that generates a 'go' and 'clear' buttons.
@@ -71,7 +71,7 @@ public class GoAndClearFilter extends Go
 	{
 		super(id, goModel);
 
-		originalState = Objects.cloneModel(form.getDefaultModelObject());
+		originalState = WicketObjects.cloneModel(form.getDefaultModelObject());
 
 		clear = new Button("clear", clearModel)
 		{
@@ -108,7 +108,7 @@ public class GoAndClearFilter extends Go
 	protected void onClearSubmit(Button button)
 	{
 		Form<Object> form = (Form<Object>)button.getForm();
-		form.setDefaultModelObject(Objects.cloneModel(originalState));
+		form.setDefaultModelObject(WicketObjects.cloneModel(originalState));
 	}
 
 }

Modified: wicket/trunk/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java (original)
+++ wicket/trunk/wicket-guice/src/test/java/org/apache/wicket/guice/GuiceInjectorTest.java Wed Mar 17 00:34:34 2010
@@ -28,7 +28,7 @@ import org.apache.wicket.mock.MockWebReq
 import org.apache.wicket.protocol.http.WebSession;
 import org.apache.wicket.protocol.http.mock.MockServletContext;
 import org.apache.wicket.request.Url;
-import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.WicketObjects;
 
 import com.google.inject.Binder;
 import com.google.inject.Module;
@@ -86,7 +86,7 @@ public class GuiceInjectorTest extends T
 			doChecksForComponent(testComponent);
 
 			// Serialize and deserialize the object, and check it still works.
-			TestComponent clonedComponent = (TestComponent)Objects.cloneObject(testComponent);
+			TestComponent clonedComponent = (TestComponent)WicketObjects.cloneObject(testComponent);
 			doChecksForComponent(clonedComponent);
 
 			// Test injection of a class that does not extend Component

Modified: wicket/trunk/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java (original)
+++ wicket/trunk/wicket-ioc/src/test/java/org/apache/wicket/proxy/LazyInitProxyFactoryTest.java Wed Mar 17 00:34:34 2010
@@ -26,7 +26,7 @@ import org.apache.wicket.proxy.util.IInt
 import org.apache.wicket.proxy.util.IObjectMethodTester;
 import org.apache.wicket.proxy.util.InterfaceObject;
 import org.apache.wicket.proxy.util.ObjectMethodTester;
-import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.WicketObjects;
 
 /**
  * Tests lazy init proxy factory
@@ -77,7 +77,7 @@ public class LazyInitProxyFactoryTest ex
 	{
 		// test proxy creation for an interface class
 		IInterface proxy = (IInterface)LazyInitProxyFactory.createProxy(IInterface.class,
-				interfaceObjectLocator);
+			interfaceObjectLocator);
 
 		// test we have a jdk dynamic proxy
 		assertTrue(Proxy.isProxyClass(proxy.getClass()));
@@ -90,7 +90,7 @@ public class LazyInitProxyFactoryTest ex
 		assertEquals(proxy.getMessage(), "interface");
 
 		// test serialization
-		IInterface proxy2 = (IInterface)Objects.cloneObject(proxy);
+		IInterface proxy2 = (IInterface)WicketObjects.cloneObject(proxy);
 		assertTrue(proxy != proxy2);
 		assertEquals(proxy2.getMessage(), "interface");
 
@@ -109,7 +109,7 @@ public class LazyInitProxyFactoryTest ex
 		};
 
 		IObjectMethodTester testerProxy = (IObjectMethodTester)LazyInitProxyFactory.createProxy(
-				IObjectMethodTester.class, testerLocator);
+			IObjectMethodTester.class, testerLocator);
 		testerProxy.equals(this);
 		testerProxy.hashCode();
 		testerProxy.toString();
@@ -122,7 +122,7 @@ public class LazyInitProxyFactoryTest ex
 	public void testConcreteProxy()
 	{
 		ConcreteObject proxy = (ConcreteObject)LazyInitProxyFactory.createProxy(
-				ConcreteObject.class, concreteObjectLocator);
+			ConcreteObject.class, concreteObjectLocator);
 
 		// test proxy implements ILazyInitProxy
 		assertTrue(proxy instanceof ILazyInitProxy);
@@ -135,7 +135,7 @@ public class LazyInitProxyFactoryTest ex
 		assertEquals(proxy.getMessage(), "concrete");
 
 		// test serialization
-		ConcreteObject proxy2 = (ConcreteObject)Objects.cloneObject(proxy);
+		ConcreteObject proxy2 = (ConcreteObject)WicketObjects.cloneObject(proxy);
 		assertTrue(proxy != proxy2);
 		assertEquals(proxy2.getMessage(), "concrete");
 
@@ -154,7 +154,7 @@ public class LazyInitProxyFactoryTest ex
 		};
 
 		ObjectMethodTester testerProxy = (ObjectMethodTester)LazyInitProxyFactory.createProxy(
-				ObjectMethodTester.class, testerLocator);
+			ObjectMethodTester.class, testerLocator);
 		testerProxy.equals(this);
 		testerProxy.hashCode();
 		testerProxy.toString();
@@ -167,9 +167,9 @@ public class LazyInitProxyFactoryTest ex
 	public void testCGLibInterceptorReplacement()
 	{
 		ProxyReplacement ser = new ProxyReplacement(ConcreteObject.class.getName(),
-				concreteObjectLocator);
+			concreteObjectLocator);
 
-		ConcreteObject proxy2 = (ConcreteObject)Objects.cloneObject(ser);
+		ConcreteObject proxy2 = (ConcreteObject)WicketObjects.cloneObject(ser);
 		assertEquals(proxy2.getMessage(), "concrete");
 	}
 

Modified: wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java (original)
+++ wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java Wed Mar 17 00:34:34 2010
@@ -21,7 +21,7 @@ import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.lang.instrument.Instrumentation;
 
-import org.apache.wicket.util.lang.Objects.IObjectSizeOfStrategy;
+import org.apache.wicket.util.lang.WicketObjects.IObjectSizeOfStrategy;
 
 /**
  * Object size of strategy that is based on instrumentation.

Modified: wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/ObjectSizeOfAgent.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/ObjectSizeOfAgent.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/ObjectSizeOfAgent.java (original)
+++ wicket/trunk/wicket-objectssizeof-agent/src/main/java/org/apache/wicket/util/instrument/ObjectSizeOfAgent.java Wed Mar 17 00:34:34 2010
@@ -18,8 +18,8 @@ package org.apache.wicket.util.instrumen
 
 import java.lang.instrument.Instrumentation;
 
-import org.apache.wicket.util.lang.Objects;
-import org.apache.wicket.util.lang.Objects.IObjectSizeOfStrategy;
+import org.apache.wicket.util.lang.WicketObjects;
+import org.apache.wicket.util.lang.WicketObjects.IObjectSizeOfStrategy;
 
 /**
  * Instrumentation agent for calculating object sizes using Java's instrumentation API. To use it,
@@ -48,7 +48,7 @@ public class ObjectSizeOfAgent
 
 		InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
 				instrumentation);
-		Objects.setObjectSizeOfStrategy(strategy);
+		WicketObjects.setObjectSizeOfStrategy(strategy);
 	}
 
 	/**
@@ -64,6 +64,6 @@ public class ObjectSizeOfAgent
 
 		InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
 				instrumentation);
-		Objects.setObjectSizeOfStrategy(strategy);
+		WicketObjects.setObjectSizeOfStrategy(strategy);
 	}
 }

Modified: wicket/trunk/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java (original)
+++ wicket/trunk/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java Wed Mar 17 00:34:34 2010
@@ -108,7 +108,7 @@ public class AnnotProxyFieldValueFactory
 	 */
 	public Object getFieldValue(Field field, Object fieldOwner)
 	{
-		if (field.isAnnotationPresent(SpringBean.class))
+		if (supportsField(field))
 		{
 			SpringBeanLocator locator = new SpringBeanLocator(getBeanName(field), field.getType(),
 					contextLocator);

Modified: wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java?rev=924074&r1=924073&r2=924074&view=diff
==============================================================================
--- wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java (original)
+++ wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java Wed Mar 17 00:34:34 2010
@@ -20,7 +20,7 @@ import junit.framework.TestCase;
 
 import org.apache.wicket.spring.test.ApplicationContextMock;
 import org.apache.wicket.spring.test.SpringContextLocatorMock;
-import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.WicketObjects;
 
 /**
  * Tests {@link SpringBeanLocator}
@@ -71,8 +71,8 @@ public class SpringBeanLocatorTest exten
 
 		ctx.putBean("bean", bean);
 
-		SpringBeanLocator locator = (SpringBeanLocator)Objects.cloneObject(new SpringBeanLocator(
-				Bean.class, ctxLocator));
+		SpringBeanLocator locator = (SpringBeanLocator)WicketObjects
+				.cloneObject(new SpringBeanLocator(Bean.class, ctxLocator));
 
 		assertNotNull(locator.locateProxyTarget());
 	}
@@ -137,8 +137,8 @@ public class SpringBeanLocatorTest exten
 		Bean bean = new Bean();
 		ctx.putBean("bean", bean);
 
-		SpringBeanLocator locator = (SpringBeanLocator)Objects.cloneObject(new SpringBeanLocator(
-				"bean", Bean.class, ctxLocator));
+		SpringBeanLocator locator = (SpringBeanLocator)WicketObjects
+				.cloneObject(new SpringBeanLocator("bean", Bean.class, ctxLocator));
 
 		assertNotNull(locator.locateProxyTarget());
 	}

Propchange: wicket/trunk/wicket-util/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Mar 17 00:34:34 2010
@@ -0,0 +1,3 @@
+target
+.classpath
+.project

Added: wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs (added)
+++ wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs Wed Mar 17 00:34:34 2010
@@ -0,0 +1,5 @@
+#Mon Mar 15 15:59:48 PDT 2010
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Propchange: wicket/trunk/wicket-util/.settings/org.eclipse.jdt.core.prefs
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/pom.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/pom.xml?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/pom.xml (added)
+++ wicket/trunk/wicket-util/pom.xml Wed Mar 17 00:34:34 2010
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>wicket-parent</artifactId>
+    <groupId>org.apache.wicket</groupId>
+    <version>1.5-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.wicket</groupId>
+  <artifactId>wicket-util</artifactId>
+  <version>1.5-SNAPSHOT</version>
+  <name>wicket-util</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: wicket/trunk/wicket-util/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.io.Serializable;
+
+/**
+ * Wicket version of {@link Serializable}. All Wicket interfaces and base classes that should
+ * typically be clustered should implement this interface. This communicates their intent and also
+ * makes configuration for <a href="http://terracotta.org/">Terracotta</a> a lot easier.
+ * 
+ * @author eelcohillenius
+ */
+public interface IClusterable extends Serializable
+{
+	// nothing here, as it is a .... brrrr .... tagging interface!
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/IClusterable.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.convert;
+
+import java.text.Format;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+
+/**
+ * Thrown for conversion exceptions.
+ * 
+ * @author Eelco Hillenius
+ */
+public class ConversionException extends RuntimeException
+{
+	private static final long serialVersionUID = 1L;
+
+	/** The converter that was used. */
+	private IConverter converter;
+
+	/** Pattern that was used for conversion. */
+	private Format format;
+
+	/** Locale that was used for conversion. */
+	private Locale locale;
+
+	/** The value that was tried to convert. */
+	private Object sourceValue;
+
+	/** Target type for the failed conversion. */
+	private Class<?> targetType;
+
+	/** Resource key for the message that should be displayed */
+	private String resourceKey;
+
+	/** Variable map to use in variable substitution */
+	private Map<String, Object> vars;
+
+	/**
+	 * Construct exception with message.
+	 * 
+	 * @param message
+	 *            message
+	 */
+	public ConversionException(String message)
+	{
+		super(message);
+	}
+
+	/**
+	 * Construct exception with message and cause.
+	 * 
+	 * @param message
+	 *            message
+	 * @param cause
+	 *            cause
+	 */
+	public ConversionException(String message, Throwable cause)
+	{
+		super(message, cause);
+	}
+
+	/**
+	 * Construct exception with cause.
+	 * 
+	 * @param cause
+	 *            cause
+	 */
+	public ConversionException(Throwable cause)
+	{
+		super(cause);
+	}
+
+	/**
+	 * Gets the used converter.
+	 * 
+	 * @return the used converter.
+	 */
+	public final IConverter getConverter()
+	{
+		return converter;
+	}
+
+	/**
+	 * Get the used format.
+	 * 
+	 * @return the used format
+	 */
+	public final Format getFormat()
+	{
+		return format;
+	}
+
+	/**
+	 * Get the used locale.
+	 * 
+	 * @return the used locale
+	 */
+	public final Locale getLocale()
+	{
+		return locale;
+	}
+
+	/**
+	 * Gets the tried value.
+	 * 
+	 * @return the tried value.
+	 */
+	public final Object getSourceValue()
+	{
+		return sourceValue;
+	}
+
+	/**
+	 * Gets the target property type.
+	 * 
+	 * @return the target property type.
+	 */
+	public final Class<?> getTargetType()
+	{
+		return targetType;
+	}
+
+	/**
+	 * Sets the used converter.
+	 * 
+	 * @param converter
+	 *            the converter.
+	 * @return This
+	 */
+	public final ConversionException setConverter(IConverter converter)
+	{
+		this.converter = converter;
+		return this;
+	}
+
+	/**
+	 * Sets the used format.
+	 * 
+	 * @param format
+	 *            the used format.
+	 * @return This
+	 */
+	public final ConversionException setFormat(Format format)
+	{
+		this.format = format;
+		return this;
+	}
+
+	/**
+	 * Sets the used locale.
+	 * 
+	 * @param locale
+	 *            the used locale.
+	 * @return This
+	 */
+	public final ConversionException setLocale(Locale locale)
+	{
+		this.locale = locale;
+		return this;
+	}
+
+	/**
+	 * Sets the tried value.
+	 * 
+	 * @param sourceValue
+	 *            the tried value.
+	 * @return This
+	 */
+	public final ConversionException setSourceValue(Object sourceValue)
+	{
+		this.sourceValue = sourceValue;
+		return this;
+	}
+
+	/**
+	 * Sets the target property type.
+	 * 
+	 * @param targetType
+	 *            sets the target property type
+	 * @return This
+	 */
+	public final ConversionException setTargetType(Class<?> targetType)
+	{
+		this.targetType = targetType;
+		return this;
+	}
+
+
+	/**
+	 * @return The resource key for the message that should be displayed
+	 */
+	public String getResourceKey()
+	{
+		return resourceKey;
+	}
+
+
+	/**
+	 * Set the resource key for the message that should be displayed.
+	 * 
+	 * @param resourceKey
+	 *            sets the resource key
+	 * @return This
+	 */
+	public ConversionException setResourceKey(String resourceKey)
+	{
+		this.resourceKey = resourceKey;
+		return this;
+	}
+
+	/**
+	 * Sets a variable that will be used in substitution
+	 * 
+	 * @param name
+	 *            variable name
+	 * @param value
+	 *            variable value
+	 * @return this for chaining
+	 */
+	public ConversionException setVariable(String name, Object value)
+	{
+		if (name == null || name.trim().length() == 0)
+		{
+			throw new IllegalArgumentException(
+					"Argument [[name]] cannot be null or an empty string");
+		}
+		if (value == null)
+		{
+			throw new IllegalArgumentException(
+					"Argument [[value]] cannot be null or an empty string");
+		}
+
+		if (vars == null)
+		{
+			vars = new HashMap<String, Object>(2);
+		}
+		vars.put(name, value);
+
+		return this;
+	}
+
+	/**
+	 * Returns the map of variables for this exception.
+	 * 
+	 * @return map of variables for this exception (or null if no variables were
+	 *         defined)
+	 */
+	public Map<String, Object> getVariables()
+	{
+		return vars;
+	}
+
+}
\ No newline at end of file

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/IConverter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/IConverter.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/IConverter.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/IConverter.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.convert;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.wicket.IClusterable;
+
+
+/**
+ * Converts input to output and vice versa. Converters are needed in web applications because we
+ * have to switch between Java objects on the server and Strings in the browser output and input.
+ * <p>
+ * Output conversion, which is handled by {@link #convertToString(Object, Locale)}, is typically
+ * used by components when they render, so that a date can be displayed as '12/12/2007'. Input
+ * conversion, handled by {@link #convertToObject(String, Locale)}, is typically used by form
+ * components to interpret incoming values Such values are strings as they are send as request
+ * parameters from browsers. An incoming value could be the string '12/12/2007' which could be
+ * translated to a corresponding {@link Date} object.
+ * 
+ * Notice that incoming value, when used by a FormComponent, will never be null because before
+ * validation form components perform the required (see {@link FormComponent#isRequired()} check
+ * which errors out on null values. In the case the FormComponent is not required and the user
+ * enters a null value converters will not be invoked because no type conversion is necessary.
+ * </p>
+ * 
+ * @author Eelco Hillenius
+ * @author Jonathan Locke
+ * 
+ */
+public interface IConverter extends IClusterable
+{
+	/**
+	 * Converts the given {@link String} value
+	 * 
+	 * @param value
+	 *            The string value to convert
+	 * @param locale
+	 *            The locale used to convert the value
+	 * @return The converted value
+	 */
+	Object convertToObject(String value, Locale locale);
+
+	/**
+	 * Converts the given value to a string.
+	 * 
+	 * @param value
+	 *            The value to convert
+	 * @param locale
+	 *            The locale used to convert the value
+	 * 
+	 * @return The converted string value
+	 */
+	String convertToString(Object value, Locale locale);
+}
\ No newline at end of file

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.convert;
+
+import java.awt.Component;
+import java.text.ParseException;
+import java.util.Locale;
+
+import javax.swing.text.MaskFormatter;
+
+
+/**
+ * A converter that takes a mask into account. It is specifically meant for overrides on individual
+ * components, that provide their own converter by returning it from
+ * {@link Component#getConverter(Class)}. It uses an instance of {@link MaskFormatter} to delegate
+ * the masking and unmasking to.
+ * <p>
+ * The following characters can be specified (adopted from the MaskFormatter documentation):
+ * 
+ * <table border=1 summary="Valid characters and their descriptions">
+ * <tr>
+ * <th>Character&nbsp;</th>
+ * <th>
+ * <p align="left"> Description
+ * </p>
+ * </th> </tr>
+ * <tr>
+ * <td>#</td>
+ * <td>Any valid number, uses <code>Character.isDigit</code>.</td>
+ * </tr>
+ * <tr>
+ * <td>'</td>
+ * <td>Escape character, used to escape any of the special formatting characters.</td>
+ * </tr>
+ * <tr>
+ * <td>U</td>
+ * <td>Any character (<code>Character.isLetter</code>). All lowercase letters are mapped to upper
+ * case.</td>
+ * </tr>
+ * <tr>
+ * <td>L</td>
+ * <td>Any character (<code>Character.isLetter</code>). All upper case letters are mapped to lower
+ * case.</td>
+ * </tr>
+ * <tr>
+ * <td>A</td>
+ * <td>Any character or number (<code>Character.isLetter</code> or <code>Character.isDigit</code>)</td>
+ * </tr>
+ * <tr>
+ * <td>?</td>
+ * <td>Any character (<code>Character.isLetter</code>).</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>Anything.</td>
+ * </tr>
+ * <tr>
+ * <td>H</td>
+ * <td>Any hex character (0-9, a-f or A-F).</td>
+ * </tr>
+ * </table>
+ * 
+ * <p>
+ * Typically characters correspond to one char, but in certain languages this is not the case. The
+ * mask is on a per character basis, and will thus adjust to fit as many chars as are needed.
+ * </p>
+ * 
+ * @see MaskFormatter
+ * 
+ * @author Eelco Hillenius
+ */
+public class MaskConverter implements IConverter
+{
+	private static final long serialVersionUID = 1L;
+
+	/** Object that knows all about masks. */
+	private final MaskFormatter maskFormatter;
+
+	/**
+	 * Construct.
+	 * 
+	 * @param maskFormatter
+	 *            The mask formatter to use for masking and unmasking values
+	 */
+	public MaskConverter(MaskFormatter maskFormatter)
+	{
+		if (maskFormatter == null)
+		{
+			throw new IllegalArgumentException("argument maskFormatter may not be null");
+		}
+
+		this.maskFormatter = maskFormatter;
+	}
+
+	/**
+	 * Construct; converts to Strings.
+	 * 
+	 * @param mask
+	 *            The mask to use for this converter instance
+	 * @see MaskFormatter
+	 */
+	public MaskConverter(String mask)
+	{
+		this(mask, String.class);
+	}
+
+	/**
+	 * Construct.
+	 * 
+	 * @param mask
+	 *            The mask to use for this converter instance
+	 * @param type
+	 *            The type to convert string values to.
+	 * @see MaskFormatter
+	 */
+	public MaskConverter(String mask, Class<?> type)
+	{
+		try
+		{
+			maskFormatter = new MaskFormatter(mask);
+			maskFormatter.setValueClass(type);
+			maskFormatter.setAllowsInvalid(true);
+			maskFormatter.setValueContainsLiteralCharacters(true);
+		}
+		catch (ParseException e)
+		{
+			throw new RuntimeException(e);
+		}
+	}
+
+	/**
+	 * Converts a string to an object using {@link MaskFormatter#stringToValue(String)}.
+	 * 
+	 * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String, Locale)
+	 */
+	public Object convertToObject(String value, Locale locale)
+	{
+		try
+		{
+			return maskFormatter.stringToValue(value);
+		}
+		catch (ParseException e)
+		{
+			throw new ConversionException(e);
+		}
+	}
+
+	/**
+	 * Converts the value to a string using {@link MaskFormatter#valueToString(Object)}.
+	 * 
+	 * @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object, Locale)
+	 */
+	public String convertToString(Object value, Locale locale)
+	{
+		try
+		{
+			return maskFormatter.valueToString(value);
+		}
+		catch (ParseException e)
+		{
+			throw new ConversionException(e);
+		}
+	}
+
+}

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.wicket.util.string.StringValue;
+
+
+/**
+ * A base class for defining enumerated types. Since this class extends StringValue, every
+ * enumerated type subclass is a StringValue that can be manipulated, converted and displayed in
+ * useful ways. In addition to constructing a type with the given name, lists are kept of all
+ * enumeration values by subclass. The list of available values in the enumeration represented by a
+ * given subclass can be retrieved by calling getValues(Class).
+ * 
+ * @author Jonathan Locke
+ */
+public abstract class EnumeratedType extends StringValue
+{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	/** Map of type values by class */
+	private static final Map<String, List<EnumeratedType>> valueListByClass = Generics.newConcurrentHashMap();
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param name
+	 *            Name of this enumerated type value
+	 */
+	public EnumeratedType(final String name)
+	{
+		super(name);
+
+		// Add this object to the list of values for our subclass
+		getValues(getClass()).add(this);
+	}
+
+	/**
+	 * Gets the enumerated type values for a given subclass of EnumeratedType.
+	 * 
+	 * @param c
+	 *            The enumerated type subclass to get values for
+	 * @return List of all values of the given subclass
+	 */
+	public static List<EnumeratedType> getValues(final Class<? extends EnumeratedType> c)
+	{
+		// Get values for class
+		List<EnumeratedType> valueList = valueListByClass.get(c.getName());
+
+		// If no list exists
+		if (valueList == null)
+		{
+			// create lazily
+			valueList = new ArrayList<EnumeratedType>();
+			valueListByClass.put(c.getName(), valueList);
+		}
+
+		return valueList;
+	}
+
+	/**
+	 * Method to ensure that == works after deserialization
+	 * 
+	 * @return object instance
+	 * @throws java.io.ObjectStreamException
+	 */
+	public Object readResolve() throws java.io.ObjectStreamException
+	{
+		EnumeratedType result = this;
+		List<EnumeratedType> values = getValues(getClass());
+		if (values != null)
+		{
+			for (Iterator<EnumeratedType> i = values.iterator(); i.hasNext();)
+			{
+				EnumeratedType type = i.next();
+				if (type.toString() != null && type.toString().equals(this.toString()))
+				{
+					result = type;
+					break;
+				}
+			}
+		}
+		return result;
+	}
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Generics related utilities
+ * 
+ * @author igor.vaynberg
+ */
+public class Generics
+{
+	private Generics()
+	{
+
+	}
+
+	/**
+	 * Silences generics warning when need to cast iterator types
+	 * 
+	 * @param <T>
+	 * @param delegate
+	 * @return <code>delegate</code> iterator cast to proper generics type
+	 */
+	@SuppressWarnings("unchecked")
+	public static <T> Iterator<T> iterator(Iterator<?> delegate)
+	{
+		return (Iterator<T>)delegate;
+	}
+
+	/**
+	 * Creates a new HashMap
+	 * 
+	 * @param <K>
+	 * @param <V>
+	 * @return new hash map
+	 */
+	public static <K, V> HashMap<K, V> newHashMap()
+	{
+		return new HashMap<K, V>();
+	}
+
+	/**
+	 * Creates a new HashMap
+	 * 
+	 * @param <K>
+	 * @param <V>
+	 * @param capacity
+	 *            initial capacity
+	 * @return new hash map
+	 */
+	public static <K, V> HashMap<K, V> newHashMap(int capacity)
+	{
+		return new HashMap<K, V>(capacity);
+	}
+
+	/**
+	 * Creates a new ArrayList
+	 * 
+	 * @param <T>
+	 * @param capacity
+	 *            initial capacity
+	 * @return array list
+	 */
+	public static <T> ArrayList<T> newArrayList(int capacity)
+	{
+		return new ArrayList<T>(capacity);
+	}
+
+	/**
+	 * Creates a new ArrayList
+	 * 
+	 * @param <T>
+	 * @return array list
+	 */
+	public static <T> ArrayList<T> newArrayList()
+	{
+		return new ArrayList<T>();
+	}
+
+	/**
+	 * Creates a new ConcurrentHashMap
+	 * 
+	 * @param <K>
+	 * @param <V>
+	 * @return new hash map
+	 */
+	public static <K, V> ConcurrentHashMap<K, V> newConcurrentHashMap()
+	{
+		return new ConcurrentHashMap<K, V>();
+	}
+
+	/**
+	 * Creates a new ConcurrentHashMap
+	 * 
+	 * @param <K>
+	 * @param <V>
+	 * @param initialCapacity
+	 *            initial capacity
+	 * @return new hash map
+	 */
+	public static <K, V> ConcurrentHashMap<K, V> newConcurrentHashMap(int initialCapacity)
+	{
+		return new ConcurrentHashMap<K, V>(initialCapacity);
+	}
+
+
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Generics.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,786 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.HashMap;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Object utilities.
+ * 
+ * @author Jonathan Locke
+ */
+public final class Objects
+{
+
+	/** Type tag meaning java.math.BigDecimal. */
+	private static final int BIGDEC = 9;
+
+	/** Type tag meaning java.math.BigInteger. */
+	private static final int BIGINT = 6;
+
+	/** Type tag meaning boolean. */
+	private static final int BOOL = 0;
+
+	/** Type tag meaning byte. */
+	private static final int BYTE = 1;
+
+	/** Type tag meaning char. */
+	private static final int CHAR = 2;
+
+	/** Type tag meaning double. */
+	private static final int DOUBLE = 8;
+
+	/** Type tag meaning float. */
+	private static final int FLOAT = 7;
+
+	/** Type tag meaning int. */
+	private static final int INT = 4;
+
+	/** log. */
+	private static final Logger log = LoggerFactory.getLogger(Objects.class);
+
+	/** Type tag meaning long. */
+	private static final int LONG = 5;
+
+	/**
+	 * The smallest type tag that represents reals as opposed to integers. You can see whether a
+	 * type tag represents reals or integers by comparing the tag to this constant: all tags less
+	 * than this constant represent integers, and all tags greater than or equal to this constant
+	 * represent reals. Of course, you must also check for NONNUMERIC, which means it is not a
+	 * number at all.
+	 */
+	private static final int MIN_REAL_TYPE = FLOAT;
+
+	/** Type tag meaning something other than a number. */
+	private static final int NONNUMERIC = 10;
+
+	/** Type tag meaning short. */
+	private static final int SHORT = 3;
+
+	/** defaults for primitives. */
+	private static final HashMap<Class<?>, Object> primitiveDefaults = Generics.newHashMap();
+
+
+	static
+	{
+		primitiveDefaults.put(Boolean.TYPE, Boolean.FALSE);
+		primitiveDefaults.put(Byte.TYPE, new Byte((byte)0));
+		primitiveDefaults.put(Short.TYPE, new Short((short)0));
+		primitiveDefaults.put(Character.TYPE, new Character((char)0));
+		primitiveDefaults.put(Integer.TYPE, new Integer(0));
+		primitiveDefaults.put(Long.TYPE, new Long(0L));
+		primitiveDefaults.put(Float.TYPE, new Float(0.0f));
+		primitiveDefaults.put(Double.TYPE, new Double(0.0));
+		primitiveDefaults.put(BigInteger.class, new BigInteger("0"));
+		primitiveDefaults.put(BigDecimal.class, new BigDecimal(0.0));
+	}
+
+	/**
+	 * Evaluates the given object as a BigDecimal.
+	 * 
+	 * @param value
+	 *            an object to interpret as a BigDecimal
+	 * @return the BigDecimal value implied by the given object
+	 * @throws NumberFormatException
+	 *             if the given object can't be understood as a BigDecimal
+	 */
+	public static BigDecimal bigDecValue(Object value) throws NumberFormatException
+	{
+		if (value == null)
+		{
+			return BigDecimal.valueOf(0L);
+		}
+		Class<?> c = value.getClass();
+		if (c == BigDecimal.class)
+		{
+			return (BigDecimal)value;
+		}
+		if (c == BigInteger.class)
+		{
+			return new BigDecimal((BigInteger)value);
+		}
+		if (c.getSuperclass() == Number.class)
+		{
+			return new BigDecimal(((Number)value).doubleValue());
+		}
+		if (c == Boolean.class)
+		{
+			return BigDecimal.valueOf(((Boolean)value).booleanValue() ? 1 : 0);
+		}
+		if (c == Character.class)
+		{
+			return BigDecimal.valueOf(((Character)value).charValue());
+		}
+		return new BigDecimal(stringValue(value, true));
+	}
+
+	/**
+	 * Evaluates the given object as a BigInteger.
+	 * 
+	 * @param value
+	 *            an object to interpret as a BigInteger
+	 * @return the BigInteger value implied by the given object
+	 * @throws NumberFormatException
+	 *             if the given object can't be understood as a BigInteger
+	 */
+	public static BigInteger bigIntValue(Object value) throws NumberFormatException
+	{
+		if (value == null)
+		{
+			return BigInteger.valueOf(0L);
+		}
+		Class<?> c = value.getClass();
+		if (c == BigInteger.class)
+		{
+			return (BigInteger)value;
+		}
+		if (c == BigDecimal.class)
+		{
+			return ((BigDecimal)value).toBigInteger();
+		}
+		if (c.getSuperclass() == Number.class)
+		{
+			return BigInteger.valueOf(((Number)value).longValue());
+		}
+		if (c == Boolean.class)
+		{
+			return BigInteger.valueOf(((Boolean)value).booleanValue() ? 1 : 0);
+		}
+		if (c == Character.class)
+		{
+			return BigInteger.valueOf(((Character)value).charValue());
+		}
+		return new BigInteger(stringValue(value, true));
+	}
+
+	/**
+	 * Evaluates the given object as a boolean: if it is a Boolean object, it's easy; if it's a
+	 * Number or a Character, returns true for non-zero objects; and otherwise returns true for
+	 * non-null objects.
+	 * 
+	 * @param value
+	 *            an object to interpret as a boolean
+	 * @return the boolean value implied by the given object
+	 */
+	public static boolean booleanValue(Object value)
+	{
+		if (value == null)
+		{
+			return false;
+		}
+		Class<?> c = value.getClass();
+		if (c == Boolean.class)
+		{
+			return ((Boolean)value).booleanValue();
+		}
+		if (c == Character.class)
+		{
+			return ((Character)value).charValue() != 0;
+		}
+		if (value instanceof Number)
+		{
+			return ((Number)value).doubleValue() != 0;
+		}
+		return true; // non-null
+	}
+
+
+
+
+
+
+	/**
+	 * Compares two objects for equality, even if it has to convert one of them to the other type.
+	 * If both objects are numeric they are converted to the widest type and compared. If one is
+	 * non-numeric and one is numeric the non-numeric is converted to double and compared to the
+	 * double numeric value. If both are non-numeric and Comparable and the types are compatible
+	 * (i.e. v1 is of the same or superclass of v2's type) they are compared with
+	 * Comparable.compareTo(). If both values are non-numeric and not Comparable or of incompatible
+	 * classes this will throw and IllegalArgumentException.
+	 * 
+	 * @param v1
+	 *            First value to compare
+	 * @param v2
+	 *            second value to compare
+	 * 
+	 * @return integer describing the comparison between the two objects. A negative number
+	 *         indicates that v1 < v2. Positive indicates that v1 > v2. Zero indicates v1 == v2.
+	 * 
+	 * @throws IllegalArgumentException
+	 *             if the objects are both non-numeric yet of incompatible types or do not implement
+	 *             Comparable.
+	 */
+	@SuppressWarnings("unchecked")
+	public static int compareWithConversion(Object v1, Object v2)
+	{
+		int result;
+
+		if (v1 == v2)
+		{
+			result = 0;
+		}
+		else
+		{
+			int t1 = getNumericType(v1), t2 = getNumericType(v2), type = getNumericType(t1, t2,
+				true);
+
+			switch (type)
+			{
+				case BIGINT :
+					result = bigIntValue(v1).compareTo(bigIntValue(v2));
+					break;
+
+				case BIGDEC :
+					result = bigDecValue(v1).compareTo(bigDecValue(v2));
+					break;
+
+				case NONNUMERIC :
+					if ((t1 == NONNUMERIC) && (t2 == NONNUMERIC))
+					{
+						if ((v1 instanceof Comparable) &&
+							v1.getClass().isAssignableFrom(v2.getClass()))
+						{
+							result = ((Comparable)v1).compareTo(v2);
+							break;
+						}
+						else
+						{
+							throw new IllegalArgumentException("invalid comparison: " +
+								v1.getClass().getName() + " and " + v2.getClass().getName());
+						}
+					}
+					// else fall through
+				case FLOAT :
+				case DOUBLE :
+					double dv1 = doubleValue(v1),
+					dv2 = doubleValue(v2);
+
+					return (dv1 == dv2) ? 0 : ((dv1 < dv2) ? -1 : 1);
+
+				default :
+					long lv1 = longValue(v1),
+					lv2 = longValue(v2);
+
+					return (lv1 == lv2) ? 0 : ((lv1 < lv2) ? -1 : 1);
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Returns the value converted numerically to the given class type
+	 * 
+	 * This method also detects when arrays are being converted and converts the components of one
+	 * array to the type of the other.
+	 * 
+	 * @param value
+	 *            an object to be converted to the given type
+	 * @param toType
+	 *            class type to be converted to
+	 * @return converted value of the type given, or value if the value cannot be converted to the
+	 *         given type.
+	 */
+	public static Object convertValue(final Object value, final Class<?> toType)
+	{
+		Object result = null;
+
+		if (value != null)
+		{
+			/* If array -> array then convert components of array individually */
+			if (value.getClass().isArray() && toType.isArray())
+			{
+				Class<?> componentType = toType.getComponentType();
+
+				result = Array.newInstance(componentType, Array.getLength(value));
+				for (int i = 0, icount = Array.getLength(value); i < icount; i++)
+				{
+					Array.set(result, i, convertValue(Array.get(value, i), componentType));
+				}
+			}
+			else
+			{
+				if ((toType == Integer.class) || (toType == Integer.TYPE))
+				{
+					result = new Integer((int)longValue(value));
+				}
+				if ((toType == Double.class) || (toType == Double.TYPE))
+				{
+					result = new Double(doubleValue(value));
+				}
+				if ((toType == Boolean.class) || (toType == Boolean.TYPE))
+				{
+					result = booleanValue(value) ? Boolean.TRUE : Boolean.FALSE;
+				}
+				if ((toType == Byte.class) || (toType == Byte.TYPE))
+				{
+					result = new Byte((byte)longValue(value));
+				}
+				if ((toType == Character.class) || (toType == Character.TYPE))
+				{
+					result = new Character((char)longValue(value));
+				}
+				if ((toType == Short.class) || (toType == Short.TYPE))
+				{
+					result = new Short((short)longValue(value));
+				}
+				if ((toType == Long.class) || (toType == Long.TYPE))
+				{
+					result = new Long(longValue(value));
+				}
+				if ((toType == Float.class) || (toType == Float.TYPE))
+				{
+					result = new Float(doubleValue(value));
+				}
+				if (toType == BigInteger.class)
+				{
+					result = bigIntValue(value);
+				}
+				if (toType == BigDecimal.class)
+				{
+					result = bigDecValue(value);
+				}
+				if (toType == String.class)
+				{
+					result = stringValue(value);
+				}
+			}
+		}
+		else
+		{
+			if (toType.isPrimitive())
+			{
+				result = primitiveDefaults.get(toType);
+			}
+		}
+		return (result != null) ? result : value;
+	}
+
+	/**
+	 * Evaluates the given object as a double-precision floating-point number.
+	 * 
+	 * @param value
+	 *            an object to interpret as a double
+	 * @return the double value implied by the given object
+	 * @throws NumberFormatException
+	 *             if the given object can't be understood as a double
+	 */
+	public static double doubleValue(Object value) throws NumberFormatException
+	{
+		if (value == null)
+		{
+			return 0.0;
+		}
+		Class<?> c = value.getClass();
+		if (c.getSuperclass() == Number.class)
+		{
+			return ((Number)value).doubleValue();
+		}
+		if (c == Boolean.class)
+		{
+			return ((Boolean)value).booleanValue() ? 1 : 0;
+		}
+		if (c == Character.class)
+		{
+			return ((Character)value).charValue();
+		}
+		String s = stringValue(value, true);
+
+		return (s.length() == 0) ? 0.0 : Double.parseDouble(s);
+	}
+
+	/**
+	 * Returns true if a and b are equal. Either object may be null.
+	 * 
+	 * @param a
+	 *            Object a
+	 * @param b
+	 *            Object b
+	 * @return True if the objects are equal
+	 */
+	public static boolean equal(final Object a, final Object b)
+	{
+		if (a == b)
+		{
+			return true;
+		}
+
+		if ((a != null) && (b != null) && a.equals(b))
+		{
+			return true;
+		}
+
+		return false;
+	}
+
+
+	/**
+	 * Returns the constant from the NumericTypes interface that best expresses the type of an
+	 * operation, which can be either numeric or not, on the two given types.
+	 * 
+	 * @param t1
+	 *            type of one argument to an operator
+	 * @param t2
+	 *            type of the other argument
+	 * @param canBeNonNumeric
+	 *            whether the operator can be interpreted as non-numeric
+	 * @return the appropriate constant from the NumericTypes interface
+	 */
+	public static int getNumericType(int t1, int t2, boolean canBeNonNumeric)
+	{
+		if (t1 == t2)
+		{
+			return t1;
+		}
+
+		if (canBeNonNumeric && (t1 == NONNUMERIC || t2 == NONNUMERIC || t1 == CHAR || t2 == CHAR))
+		{
+			return NONNUMERIC;
+		}
+
+		if (t1 == NONNUMERIC)
+		{
+			t1 = DOUBLE; // Try to interpret strings as doubles...
+		}
+		if (t2 == NONNUMERIC)
+		{
+			t2 = DOUBLE; // Try to interpret strings as doubles...
+		}
+
+		if (t1 >= MIN_REAL_TYPE)
+		{
+			if (t2 >= MIN_REAL_TYPE)
+			{
+				return Math.max(t1, t2);
+			}
+			if (t2 < INT)
+			{
+				return t1;
+			}
+			if (t2 == BIGINT)
+			{
+				return BIGDEC;
+			}
+			return Math.max(DOUBLE, t1);
+		}
+		else if (t2 >= MIN_REAL_TYPE)
+		{
+			if (t1 < INT)
+			{
+				return t2;
+			}
+			if (t1 == BIGINT)
+			{
+				return BIGDEC;
+			}
+			return Math.max(DOUBLE, t2);
+		}
+		else
+		{
+			return Math.max(t1, t2);
+		}
+	}
+
+	/**
+	 * Returns a constant from the NumericTypes interface that represents the numeric type of the
+	 * given object.
+	 * 
+	 * @param value
+	 *            an object that needs to be interpreted as a number
+	 * @return the appropriate constant from the NumericTypes interface
+	 */
+	public static int getNumericType(Object value)
+	{
+		if (value != null)
+		{
+			Class<?> c = value.getClass();
+			if (c == Integer.class)
+			{
+				return INT;
+			}
+			if (c == Double.class)
+			{
+				return DOUBLE;
+			}
+			if (c == Boolean.class)
+			{
+				return BOOL;
+			}
+			if (c == Byte.class)
+			{
+				return BYTE;
+			}
+			if (c == Character.class)
+			{
+				return CHAR;
+			}
+			if (c == Short.class)
+			{
+				return SHORT;
+			}
+			if (c == Long.class)
+			{
+				return LONG;
+			}
+			if (c == Float.class)
+			{
+				return FLOAT;
+			}
+			if (c == BigInteger.class)
+			{
+				return BIGINT;
+			}
+			if (c == BigDecimal.class)
+			{
+				return BIGDEC;
+			}
+		}
+		return NONNUMERIC;
+	}
+
+	/**
+	 * Returns the constant from the NumericTypes interface that best expresses the type of a
+	 * numeric operation on the two given objects.
+	 * 
+	 * @param v1
+	 *            one argument to a numeric operator
+	 * @param v2
+	 *            the other argument
+	 * @return the appropriate constant from the NumericTypes interface
+	 */
+	public static int getNumericType(Object v1, Object v2)
+	{
+		return getNumericType(v1, v2, false);
+	}
+
+	/**
+	 * Returns the constant from the NumericTypes interface that best expresses the type of an
+	 * operation, which can be either numeric or not, on the two given objects.
+	 * 
+	 * @param v1
+	 *            one argument to an operator
+	 * @param v2
+	 *            the other argument
+	 * @param canBeNonNumeric
+	 *            whether the operator can be interpreted as non-numeric
+	 * @return the appropriate constant from the NumericTypes interface
+	 */
+	public static int getNumericType(Object v1, Object v2, boolean canBeNonNumeric)
+	{
+		return getNumericType(getNumericType(v1), getNumericType(v2), canBeNonNumeric);
+	}
+
+	/**
+	 * Returns true if object1 is equal to object2 in either the sense that they are the same object
+	 * or, if both are non-null if they are equal in the <CODE>equals()</CODE> sense.
+	 * 
+	 * @param object1
+	 *            First object to compare
+	 * @param object2
+	 *            Second object to compare
+	 * 
+	 * @return true if v1 == v2
+	 */
+	public static boolean isEqual(Object object1, Object object2)
+	{
+		boolean result = false;
+
+		if (object1 == object2)
+		{
+			result = true;
+		}
+		else
+		{
+			if ((object1 != null) && object1.getClass().isArray())
+			{
+				if ((object2 != null) && object2.getClass().isArray() &&
+					(object2.getClass() == object1.getClass()))
+				{
+					result = (Array.getLength(object1) == Array.getLength(object2));
+					if (result)
+					{
+						for (int i = 0, icount = Array.getLength(object1); result && (i < icount); i++)
+						{
+							result = isEqual(Array.get(object1, i), Array.get(object2, i));
+						}
+					}
+				}
+			}
+			else
+			{
+				// Check for converted equivalence first, then equals()
+				// equivalence
+				result = (object1 != null) && (object2 != null) &&
+					((compareWithConversion(object1, object2) == 0) || object1.equals(object2));
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Evaluates the given object as a long integer.
+	 * 
+	 * @param value
+	 *            an object to interpret as a long integer
+	 * @return the long integer value implied by the given object
+	 * @throws NumberFormatException
+	 *             if the given object can't be understood as a long integer
+	 */
+	public static long longValue(Object value) throws NumberFormatException
+	{
+		if (value == null)
+		{
+			return 0L;
+		}
+		Class<?> c = value.getClass();
+		if (c.getSuperclass() == Number.class)
+		{
+			return ((Number)value).longValue();
+		}
+		if (c == Boolean.class)
+		{
+			return ((Boolean)value).booleanValue() ? 1 : 0;
+		}
+		if (c == Character.class)
+		{
+			return ((Character)value).charValue();
+		}
+		return Long.parseLong(stringValue(value, true));
+	}
+
+
+
+	/**
+	 * Returns a new Number object of an appropriate type to hold the given integer value. The type
+	 * of the returned object is consistent with the given type argument, which is a constant from
+	 * the NumericTypes interface.
+	 * 
+	 * @param type
+	 *            the nominal numeric type of the result, a constant from the NumericTypes interface
+	 * @param value
+	 *            the integer value to convert to a Number object
+	 * @return a Number object with the given value, of type implied by the type argument
+	 */
+	public static Number newInteger(int type, long value)
+	{
+		switch (type)
+		{
+			case BOOL :
+			case CHAR :
+			case INT :
+				return new Integer((int)value);
+
+			case FLOAT :
+				return new Float(value);
+
+			case DOUBLE :
+				return new Double(value);
+
+			case LONG :
+				return new Long(value);
+
+			case BYTE :
+				return new Byte((byte)value);
+
+			case SHORT :
+				return new Short((short)value);
+
+			default :
+				return BigInteger.valueOf(value);
+		}
+	}
+
+
+
+
+
+
+	/**
+	 * Evaluates the given object as a String.
+	 * 
+	 * @param value
+	 *            an object to interpret as a String
+	 * @return the String value implied by the given object as returned by the toString() method, or
+	 *         "null" if the object is null.
+	 */
+	public static String stringValue(Object value)
+	{
+		return stringValue(value, false);
+	}
+
+	/**
+	 * returns hashcode of the objects by calling obj.hashcode(). safe to use when obj is null.
+	 * 
+	 * @param obj
+	 * @return hashcode of the object or 0 if obj is null
+	 */
+	public static int hashCode(final Object... obj)
+	{
+		if (obj == null || obj.length == 0)
+		{
+			return 0;
+		}
+		int result = 37;
+		for (int i = obj.length - 1; i > -1; i--)
+		{
+			result = 37 * result + (obj[i] != null ? obj[i].hashCode() : 0);
+		}
+		return result;
+	}
+
+	/**
+	 * Evaluates the given object as a String and trims it if the trim flag is true.
+	 * 
+	 * @param value
+	 *            an object to interpret as a String
+	 * @param trim
+	 *            whether to trim the string
+	 * @return the String value implied by the given object as returned by the toString() method, or
+	 *         "null" if the object is null.
+	 */
+	public static String stringValue(Object value, boolean trim)
+	{
+		String result;
+
+		if (value == null)
+		{
+			result = "null";
+		}
+		else
+		{
+			result = value.toString();
+			if (trim)
+			{
+				result = result.trim();
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Instantiation not allowed
+	 */
+	private Objects()
+	{
+	}
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Objects.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import org.apache.wicket.IClusterable;
+
+/**
+ * A type-safe package name class since Package is unreliable (it's not a Package object, but rather
+ * a sometimes-available holder for versioning information).
+ * 
+ * @author Jonathan Locke
+ */
+public class PackageName implements IClusterable
+{
+	private static final long serialVersionUID = 1L;
+
+	// The name of this package
+	private final String name;
+
+	/**
+	 * @param c
+	 *            The class to get a PackageName object for
+	 * @return The PackageName object
+	 */
+	public static PackageName forClass(final Class<?> c)
+	{
+		return new PackageName(Packages.extractPackageName(c));
+	}
+
+	/**
+	 * @param p
+	 *            The package to get a PackageName object for
+	 * @return The package name
+	 */
+	public static PackageName forPackage(final Package p)
+	{
+		return new PackageName(p.getName());
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            The name of this package
+	 */
+	private PackageName(final String name)
+	{
+		this.name = name;
+	}
+
+	/**
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object that)
+	{
+		if (that instanceof PackageName)
+		{
+			return ((PackageName)that).name.equals(name);
+		}
+		return false;
+	}
+
+	/**
+	 * @return The fully qualified name of this package
+	 */
+	public String getName()
+	{
+		return name;
+	}
+
+	/**
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString()
+	{
+		return name;
+	}
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/PackageName.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+import org.apache.wicket.util.string.IStringIterator;
+import org.apache.wicket.util.string.StringList;
+
+/**
+ * Utilities for dealing with packages.
+ * 
+ * @author Jonathan Locke
+ * @author Niclas Hedhman
+ */
+public final class Packages
+{
+	/**
+	 * Takes a package and a relative path to a resource and returns an absolute path to the
+	 * resource. For example, if the given package was java.lang and the relative path was
+	 * "../util/List", then "java/util/List" would be returned.
+	 * 
+	 * @param p
+	 *            The package to start at
+	 * @param relativePath
+	 *            The relative path to the class
+	 * @return The absolute path
+	 */
+	public static String absolutePath(final Class<?> p, final String relativePath)
+	{
+		String packName = (p != null ? extractPackageName(p) : "");
+		return absolutePath(packName, relativePath);
+	}
+
+	/**
+	 * Takes a package and a relative path to a resource and returns an absolute path to the
+	 * resource. For example, if the given package was java.lang and the relative path was
+	 * "../util/List", then "java/util/List" would be returned.
+	 * 
+	 * @param p
+	 *            The package to start at
+	 * @param relativePath
+	 *            The relative path to the class
+	 * @return The absolute path
+	 */
+	public static String absolutePath(final Package p, final String relativePath)
+	{
+		return absolutePath(p.getName(), relativePath);
+	}
+
+	/**
+	 * Takes a package and a relative path to a resource and returns an absolute path to the
+	 * resource. For example, if the given package was java.lang and the relative path was
+	 * "../util/List", then "java/util/List" would be returned.
+	 * 
+	 * @param packageName
+	 *            The package to start at
+	 * @param relativePath
+	 *            The relative path to the class
+	 * @return The absolute path
+	 */
+	public static String absolutePath(final String packageName, final String relativePath)
+	{
+		// Is path already absolute?
+		if (relativePath.startsWith("/"))
+		{
+			return relativePath;
+		}
+		else
+		{
+			// Break package into list of package names
+			final StringList absolutePath = StringList.tokenize(packageName, ".");
+
+			// Break path into folders
+			final StringList folders = StringList.tokenize(relativePath, "/\\");
+
+			// Iterate through folders
+			for (final IStringIterator iterator = folders.iterator(); iterator.hasNext();)
+			{
+				// Get next folder
+				final String folder = iterator.next();
+
+				// Up one?
+				if ("..".equals(folder))
+				{
+					// Pop off stack
+					if (absolutePath.size() > 0)
+					{
+						absolutePath.removeLast();
+					}
+					else
+					{
+						throw new IllegalArgumentException("Invalid path " + relativePath);
+					}
+				}
+				else
+				{
+					// Add to stack
+					absolutePath.add(folder);
+				}
+			}
+
+			// Return absolute path
+			return absolutePath.join("/");
+		}
+	}
+
+	/**
+	 * Determines the package name for the given class.
+	 * 
+	 * @param forClass
+	 *            the class
+	 * @return the package name
+	 */
+	public static String extractPackageName(final Class<?> forClass)
+	{
+		String classname = forClass.getName();
+		String parent = parent(classname);
+		return parent;
+	}
+
+	/**
+	 * Gets the parent package name.
+	 * 
+	 * @param packageName
+	 *            The Package name
+	 * @return The parent Package
+	 */
+	public static String parent(final String packageName)
+	{
+		int pos = packageName.lastIndexOf(".");
+		String parent;
+		if (pos < 0)
+		{
+			pos = packageName.lastIndexOf("/");
+			if (pos < 0)
+			{
+				pos = 0;
+			}
+		}
+		parent = packageName.substring(0, pos);
+		return parent;
+	}
+
+
+	/**
+	 * Resolve scope for the given class by extracting it's package name and converting all dots to
+	 * slashes.
+	 * 
+	 * @param forClass
+	 *            the class
+	 * @return the scope string
+	 */
+	public static String resolveScope(final Class<?> forClass)
+	{
+		String packName = extractPackageName(forClass);
+		return packName.replace('.', '/');
+	}
+
+	/**
+	 * Instantiation not allowed.
+	 */
+	private Packages()
+	{
+	}
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Packages.java
------------------------------------------------------------------------------
    svn:executable = *

Added: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java?rev=924074&view=auto
==============================================================================
--- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java (added)
+++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java Wed Mar 17 00:34:34 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.lang;
+
+/**
+ * Utilities for working with primitives types and values.
+ * 
+ * @author Jonathan Locke
+ */
+public final class Primitives
+{
+	/**
+	 * Returns a basic integer hash code for a long value.
+	 * 
+	 * @param value
+	 *            The long value
+	 * @return The hash code
+	 */
+	public static int hashCode(final long value)
+	{
+		return (int)value ^ (int)(value >> 32);
+	}
+}

Propchange: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/lang/Primitives.java
------------------------------------------------------------------------------
    svn:executable = *