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 2013/06/26 11:32:02 UTC
[1/3] git commit: Fix warnings in IDE - no need to use 'final' on
static methods
Updated Branches:
refs/heads/master 835223065 -> bfcd615e8
Fix warnings in IDE - no need to use 'final' on static methods
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/bfcd615e
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/bfcd615e
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/bfcd615e
Branch: refs/heads/master
Commit: bfcd615e89241fa6a12886d86180cb74fb15a3c9
Parents: 817db86
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 26 11:44:58 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 26 12:31:51 2013 +0300
----------------------------------------------------------------------
.../wicket/core/util/lang/PropertyResolver.java | 28 ++++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/bfcd615e/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
index 4e0aa44..b39d853 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
@@ -91,7 +91,7 @@ public final class PropertyResolver
* The object which is evaluated.
* @return The value that is evaluated. Null something in the expression evaluated to null.
*/
- public final static Object getValue(final String expression, final Object object)
+ public static Object getValue(final String expression, final Object object)
{
if (expression == null || expression.equals("") || object == null)
{
@@ -124,7 +124,7 @@ public final class PropertyResolver
* The converter to convert the value if needed to the right type.
* @throws WicketRuntimeException
*/
- public final static void setValue(final String expression, final Object object,
+ public static void setValue(final String expression, final Object object,
final Object value, final PropertyResolverConverter converter)
{
if (expression == null || expression.equals(""))
@@ -155,7 +155,7 @@ public final class PropertyResolver
* @return class of the target property object
* @throws WicketRuntimeException if the cannot be resolved
*/
- public final static Class<?> getPropertyClass(final String expression, final Object object)
+ public static Class<?> getPropertyClass(final String expression, final Object object)
{
ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
if (setter == null)
@@ -191,7 +191,7 @@ public final class PropertyResolver
* @return Field for the property expression
* @throws WicketRuntimeException if there is no such field
*/
- public final static Field getPropertyField(final String expression, final Object object)
+ public static Field getPropertyField(final String expression, final Object object)
{
ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
if (setter == null)
@@ -208,7 +208,7 @@ public final class PropertyResolver
* @return Getter method for the property expression
* @throws WicketRuntimeException if there is no getter method
*/
- public final static Method getPropertyGetter(final String expression, final Object object)
+ public static Method getPropertyGetter(final String expression, final Object object)
{
ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
if (setter == null)
@@ -225,7 +225,7 @@ public final class PropertyResolver
* @return Setter method for the property expression
* @throws WicketRuntimeException if there is no setter method
*/
- public final static Method getPropertySetter(final String expression, final Object object)
+ public static Method getPropertySetter(final String expression, final Object object)
{
ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
if (setter == null)
@@ -377,7 +377,7 @@ public final class PropertyResolver
return -1;
}
- private final static IGetAndSet getGetAndSetter(String exp, final Class<?> clz)
+ private static IGetAndSet getGetAndSetter(String exp, final Class<?> clz)
{
IClassCache classesToGetAndSetters = getClassesToGetAndSetters();
Map<String, IGetAndSet> getAndSetters = classesToGetAndSetters.get(clz);
@@ -391,7 +391,7 @@ public final class PropertyResolver
if (getAndSetter == null)
{
Method method = null;
- Field field = null;
+ Field field;
if (exp.startsWith("["))
{
// if expression begins with [ skip method finding and use it as
@@ -570,7 +570,7 @@ public final class PropertyResolver
* @param expression
* @return The method for the expression null if not found
*/
- private final static Method findGetter(final Class<?> clz, final String expression)
+ private static Method findGetter(final Class<?> clz, final String expression)
{
String name = Character.toUpperCase(expression.charAt(0)) + expression.substring(1);
Method method = null;
@@ -595,7 +595,7 @@ public final class PropertyResolver
return method;
}
- private final static Method findMethod(final Class<?> clz, String expression)
+ private static Method findMethod(final Class<?> clz, String expression)
{
if (expression.endsWith("()"))
{
@@ -1003,7 +1003,7 @@ public final class PropertyResolver
getMethod.setAccessible(true);
}
- private final static Method findSetter(final Method getMethod, final Class<?> clz)
+ private static Method findSetter(final Method getMethod, final Class<?> clz)
{
String name = getMethod.getName();
name = SET + name.substring(3);
@@ -1024,7 +1024,7 @@ public final class PropertyResolver
@Override
public Object getValue(Object object)
{
- Object ret = null;
+ Object ret;
try
{
ret = getMethod.invoke(object, index);
@@ -1145,7 +1145,7 @@ public final class PropertyResolver
@Override
public final Object getValue(final Object object)
{
- Object ret = null;
+ Object ret;
try
{
ret = getMethod.invoke(object, (Object[])null);
@@ -1243,7 +1243,7 @@ public final class PropertyResolver
}
}
- private final static Method findSetter(Method getMethod, Class<?> clz)
+ private static Method findSetter(Method getMethod, Class<?> clz)
{
String name = getMethod.getName();
if (name.startsWith(GET))
[2/3] git commit: Add a note that PropertyResolver uses
setAccessible(true) to be able to access private fields and methods
Posted by mg...@apache.org.
Add a note that PropertyResolver uses setAccessible(true) to be able to access private fields and methods
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/817db866
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/817db866
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/817db866
Branch: refs/heads/master
Commit: 817db866606b7512b0063b77985c91e003fc6034
Parents: ebf7bee
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 26 11:40:56 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 26 12:31:51 2013 +0300
----------------------------------------------------------------------
.../java/org/apache/wicket/core/util/lang/PropertyResolver.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/817db866/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
index 5a95240..4e0aa44 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
@@ -57,6 +57,10 @@ import org.slf4j.LoggerFactory;
* <p/>
* <p>
* Index or map properties can also be written as: "property[index]" or "property[key]"
+ *
+ * <strong>Note that the property resolver by default provides access to private members and methods. If
+ * guaranteeing encapsulation of the target objects is a big concern, you should consider using an
+ * alternative implementation.</strong>
* <p/>
*
* @author jcompagner
[3/3] git commit: Java 7 diamonds
Posted by mg...@apache.org.
Java 7 diamonds
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ebf7beef
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ebf7beef
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ebf7beef
Branch: refs/heads/master
Commit: ebf7beeffa3a44c7926c731ee30c17d69a3b599f
Parents: 8352230
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Jun 26 10:38:39 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jun 26 12:31:51 2013 +0300
----------------------------------------------------------------------
.../main/java/org/apache/wicket/markup/html/list/ListView.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/ebf7beef/wicket-core/src/main/java/org/apache/wicket/markup/html/list/ListView.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/list/ListView.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/list/ListView.java
index 7990084..69a16d2 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/list/ListView.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/list/ListView.java
@@ -264,7 +264,7 @@ public abstract class ListView<T> extends AbstractRepeater
@Override
public void onClick()
{
- final int index = (int)item.getIndex();
+ final int index = item.getIndex();
if (index != -1)
{
addStateChange();
@@ -446,7 +446,7 @@ public abstract class ListView<T> extends AbstractRepeater
protected IModel<T> getListItemModel(final IModel<? extends List<T>> listViewModel,
final int index)
{
- return new ListItemModel<T>(this, index);
+ return new ListItemModel<>(this, index);
}
/**
@@ -459,7 +459,7 @@ public abstract class ListView<T> extends AbstractRepeater
*/
protected ListItem<T> newItem(final int index, IModel<T> itemModel)
{
- return new ListItem<T>(index, itemModel);
+ return new ListItem<>(index, itemModel);
}
/**