You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pe...@apache.org on 2010/11/24 01:13:30 UTC
svn commit: r1038394 -
/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java
Author: pete
Date: Wed Nov 24 00:13:30 2010
New Revision: 1038394
URL: http://svn.apache.org/viewvc?rev=1038394&view=rev
Log:
fix compilation issue with generics - was not compilable in IDEA (and possibly in other IDEs and build environments, too)
Modified:
wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java
Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java?rev=1038394&r1=1038393&r2=1038394&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/FormInput.java Wed Nov 24 00:13:30 2010
@@ -154,26 +154,7 @@ public class FormInput extends WicketExa
{
if (URL.class.isAssignableFrom(type))
{
- return (IConverter<C>)new IConverter<URL>()
- {
- public URL convertToObject(String value, Locale locale)
- {
- try
- {
- return new URL(value.toString());
- }
- catch (MalformedURLException e)
- {
- throw new ConversionException("'" + value +
- "' is not a valid URL");
- }
- }
-
- public String convertToString(URL value, Locale locale)
- {
- return value != null ? value.toString() : null;
- }
- };
+ return (IConverter<C>)URLConverter.INSTANCE;
}
else
{
@@ -356,4 +337,26 @@ public class FormInput extends WicketExa
getSession().setLocale(locale);
}
}
+
+ private static class URLConverter implements IConverter<URL>
+ {
+ public static final URLConverter INSTANCE = new URLConverter();
+
+ public URL convertToObject(String value, Locale locale)
+ {
+ try
+ {
+ return new URL(value);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new ConversionException("'" + value + "' is not a valid URL");
+ }
+ }
+
+ public String convertToString(URL value, Locale locale)
+ {
+ return value != null ? value.toString() : null;
+ }
+ }
}