You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/02/23 16:56:41 UTC
[1/2] git commit: WICKET-3990 Eliminate all protected static methods
for better Scala integration
Updated Branches:
refs/heads/master f6b22863c -> a69532e69
WICKET-3990 Eliminate all protected static methods for better Scala integration
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/a69532e6
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/a69532e6
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/a69532e6
Branch: refs/heads/master
Commit: a69532e6946550a1bdfe4a899512c7da40f0a41a
Parents: a78794c
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Thu Feb 23 16:34:58 2012 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Thu Feb 23 16:34:58 2012 +0100
----------------------------------------------------------------------
.../apache/wicket/markup/head/CssHeaderItem.java | 2 +-
.../wicket/markup/head/JavaScriptHeaderItem.java | 2 +-
.../wicket/markup/html/form/FormComponent.java | 2 +-
.../apache/wicket/markup/html/form/ListChoice.java | 41 ++++-----------
.../markup/html/form/ListMultipleChoice.java | 25 +--------
.../protocol/http/AbstractRequestLogger.java | 2 +-
.../mapper/AbstractResourceReferenceMapper.java | 4 +-
.../apache/wicket/proxy/LazyInitProxyFactory.java | 10 ++--
8 files changed, 23 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
index 42d05ca..cf82644 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
@@ -186,7 +186,7 @@ public abstract class CssHeaderItem extends HeaderItem
return new CssUrlReferenceHeaderItem(url, media, condition);
}
- protected static void internalRenderCSSReference(Response response, String url, String media,
+ protected final void internalRenderCSSReference(Response response, String url, String media,
String condition)
{
Args.notEmpty(url, "url");
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
index a357bc0..faf4d9a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
@@ -284,7 +284,7 @@ public abstract class JavaScriptHeaderItem extends HeaderItem
return new JavaScriptUrlReferenceHeaderItem(url, id, defer, charset, condition);
}
- protected static void internalRenderJavaScriptReference(Response response, String url,
+ protected final void internalRenderJavaScriptReference(Response response, String url,
String id, boolean defer, String charset, String condition)
{
Args.notEmpty(url, "url");
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
index 7db574a..815fd1c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
@@ -1534,7 +1534,7 @@ public abstract class FormComponent<T> extends LabeledWebMarkupContainer
* @throws UnsupportedOperationException
* if the existing model object Collection cannot be modified
*/
- protected static <S> void updateCollectionModel(FormComponent<Collection<S>> formComponent)
+ public static <S> void updateCollectionModel(FormComponent<Collection<S>> formComponent)
{
Collection<S> convertedInput = formComponent.getConvertedInput();
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListChoice.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListChoice.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListChoice.java
index d997e70..d01c563 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListChoice.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListChoice.java
@@ -38,38 +38,17 @@ public class ListChoice<T> extends DropDownChoice<T>
private static final long serialVersionUID = 1L;
/** The default maximum number of rows to display. */
- private static int defaultMaxRows = 8;
+ private static final int DEFAULT_MAX_ROWS = 8;
/** The maximum number of rows to display. */
private int maxRows;
/**
- * Gets the default maximum number of rows to display.
- *
- * @return Returns the defaultMaxRows.
- */
- protected static int getDefaultMaxRows()
- {
- return defaultMaxRows;
- }
-
- /**
- * Sets the default maximum number of rows to display.
- *
- * @param defaultMaxRows
- * The defaultMaxRows to set.
- */
- protected static void setDefaultMaxRows(final int defaultMaxRows)
- {
- ListChoice.defaultMaxRows = defaultMaxRows;
- }
-
- /**
* @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String)
*/
public ListChoice(final String id)
{
- this(id, null, (List<? extends T>)null, null, defaultMaxRows);
+ this(id, null, (List<? extends T>)null, null, DEFAULT_MAX_ROWS);
}
/**
@@ -77,7 +56,7 @@ public class ListChoice<T> extends DropDownChoice<T>
*/
public ListChoice(final String id, final List<? extends T> choices)
{
- this(id, null, choices, null, defaultMaxRows);
+ this(id, null, choices, null, DEFAULT_MAX_ROWS);
}
/**
@@ -93,7 +72,7 @@ public class ListChoice<T> extends DropDownChoice<T>
public ListChoice(final String id, final List<? extends T> choices,
final IChoiceRenderer<? super T> renderer)
{
- this(id, null, choices, renderer, defaultMaxRows);
+ this(id, null, choices, renderer, DEFAULT_MAX_ROWS);
}
@@ -108,7 +87,7 @@ public class ListChoice<T> extends DropDownChoice<T>
*/
public ListChoice(final String id, final IModel<T> model, final List<? extends T> choices)
{
- this(id, model, choices, null, defaultMaxRows);
+ this(id, model, choices, null, DEFAULT_MAX_ROWS);
}
/**
@@ -142,7 +121,7 @@ public class ListChoice<T> extends DropDownChoice<T>
public ListChoice(final String id, final IModel<T> model, final List<? extends T> choices,
final IChoiceRenderer<? super T> renderer)
{
- this(id, model, choices, renderer, defaultMaxRows);
+ this(id, model, choices, renderer, DEFAULT_MAX_ROWS);
}
/**
@@ -170,7 +149,7 @@ public class ListChoice<T> extends DropDownChoice<T>
*/
public ListChoice(String id, IModel<? extends List<? extends T>> choices)
{
- this(id, null, choices, null, defaultMaxRows);
+ this(id, null, choices, null, DEFAULT_MAX_ROWS);
}
/**
@@ -178,7 +157,7 @@ public class ListChoice<T> extends DropDownChoice<T>
*/
public ListChoice(String id, IModel<T> model, IModel<? extends List<? extends T>> choices)
{
- this(id, model, choices, null, defaultMaxRows);
+ this(id, model, choices, null, DEFAULT_MAX_ROWS);
}
/**
@@ -188,7 +167,7 @@ public class ListChoice<T> extends DropDownChoice<T>
public ListChoice(String id, IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
{
- this(id, null, choices, renderer, defaultMaxRows);
+ this(id, null, choices, renderer, DEFAULT_MAX_ROWS);
}
@@ -199,7 +178,7 @@ public class ListChoice<T> extends DropDownChoice<T>
public ListChoice(String id, IModel<T> model, IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
{
- this(id, model, choices, renderer, defaultMaxRows);
+ this(id, model, choices, renderer, DEFAULT_MAX_ROWS);
}
/**
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
index 2ffffd5..034a52a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ListMultipleChoice.java
@@ -50,31 +50,10 @@ public class ListMultipleChoice<T> extends AbstractChoice<Collection<T>, T>
};
/** The default maximum number of rows to display. */
- private static int defaultMaxRows = 8;
+ private static final int DEFAULT_MAX_ROWS = 8;
/** The maximum number of rows to display. */
- private int maxRows = defaultMaxRows;
-
- /**
- * Gets the default maximum number of rows to display.
- *
- * @return Returns the defaultMaxRows.
- */
- protected static int getDefaultMaxRows()
- {
- return defaultMaxRows;
- }
-
- /**
- * Sets the default maximum number of rows to display.
- *
- * @param defaultMaxRows
- * The defaultMaxRows to set.
- */
- protected static void setDefaultMaxRows(final int defaultMaxRows)
- {
- ListMultipleChoice.defaultMaxRows = defaultMaxRows;
- }
+ private int maxRows = DEFAULT_MAX_ROWS;
/**
* @see org.apache.wicket.markup.html.form.AbstractChoice#AbstractChoice(String)
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
index 71920d1..82e1a21 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java
@@ -493,7 +493,7 @@ public abstract class AbstractRequestLogger implements IRequestLogger
* the date to format
* @return the formatted date
*/
- protected static String formatDate(final Date date)
+ protected final String formatDate(final Date date)
{
Args.notNull(date, "date");
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-core/src/main/java/org/apache/wicket/request/mapper/AbstractResourceReferenceMapper.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/mapper/AbstractResourceReferenceMapper.java b/wicket-core/src/main/java/org/apache/wicket/request/mapper/AbstractResourceReferenceMapper.java
index ce4896c..674bbc0 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/mapper/AbstractResourceReferenceMapper.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/mapper/AbstractResourceReferenceMapper.java
@@ -32,7 +32,7 @@ import org.apache.wicket.util.string.Strings;
public abstract class AbstractResourceReferenceMapper extends AbstractComponentMapper
{
- protected static String encodeResourceReferenceAttributes(
+ protected final String encodeResourceReferenceAttributes(
ResourceReference.UrlAttributes attributes)
{
if (attributes == null ||
@@ -81,7 +81,7 @@ public abstract class AbstractResourceReferenceMapper extends AbstractComponentM
}
}
- protected static ResourceReference.UrlAttributes decodeResourceReferenceAttributes(
+ protected final ResourceReference.UrlAttributes decodeResourceReferenceAttributes(
String attributes)
{
Locale locale = null;
http://git-wip-us.apache.org/repos/asf/wicket/blob/a69532e6/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
----------------------------------------------------------------------
diff --git a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
index cea501b..4f77e3f 100644
--- a/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
+++ b/wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java
@@ -445,7 +445,7 @@ public class LazyInitProxyFactory
* method being tested
* @return true if the method is derived from Object.equals(), false otherwise
*/
- protected static boolean isEqualsMethod(final Method method)
+ public static boolean isEqualsMethod(final Method method)
{
return (method.getReturnType() == boolean.class) &&
(method.getParameterTypes().length == 1) &&
@@ -459,7 +459,7 @@ public class LazyInitProxyFactory
* method being tested
* @return true if the method is defined from Object.hashCode(), false otherwise
*/
- protected static boolean isHashCodeMethod(final Method method)
+ public static boolean isHashCodeMethod(final Method method)
{
return (method.getReturnType() == int.class) && (method.getParameterTypes().length == 0) &&
method.getName().equals("hashCode");
@@ -472,7 +472,7 @@ public class LazyInitProxyFactory
* method being tested
* @return true if the method is defined from Object.toString(), false otherwise
*/
- protected static boolean isToStringMethod(final Method method)
+ public static boolean isToStringMethod(final Method method)
{
return (method.getReturnType() == String.class) &&
(method.getParameterTypes().length == 0) && method.getName().equals("toString");
@@ -485,7 +485,7 @@ public class LazyInitProxyFactory
* method being tested
* @return true if the method is defined from Object.finalize(), false otherwise
*/
- protected static boolean isFinalizeMethod(final Method method)
+ public static boolean isFinalizeMethod(final Method method)
{
return (method.getReturnType() == void.class) && (method.getParameterTypes().length == 0) &&
method.getName().equals("finalize");
@@ -498,7 +498,7 @@ public class LazyInitProxyFactory
* method being tested
* @return true if the method is the writeReplace method, false otherwise
*/
- protected static boolean isWriteReplaceMethod(final Method method)
+ public static boolean isWriteReplaceMethod(final Method method)
{
return (method.getReturnType() == Object.class) &&
(method.getParameterTypes().length == 0) && method.getName().equals("writeReplace");