diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-04-10 13:08:46 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-04-10 13:08:46 +0000 |
commit | 387603a6712a68c05fdb154824fe950b2df9c451 (patch) | |
tree | 392468c2554e64a41f3ff6f29753664e8c73b674 /server/src/com/vaadin/data/util | |
parent | 27e65d32145f0010f5cb459d4032209e33166a23 (diff) | |
parent | a6f46696d07e9301daac1f72674afa0f1b1626a6 (diff) | |
download | vaadin-framework-387603a6712a68c05fdb154824fe950b2df9c451.tar.gz vaadin-framework-387603a6712a68c05fdb154824fe950b2df9c451.zip |
Merge "Merge branch 'master' into grid" into grid
Diffstat (limited to 'server/src/com/vaadin/data/util')
5 files changed, 23 insertions, 15 deletions
diff --git a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java index 8022b4d571..bb592245f1 100644 --- a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java +++ b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java @@ -95,7 +95,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, } return 0; } - }; + } /** * Constructs a new hierarchical wrapper for an existing Container. Works diff --git a/server/src/com/vaadin/data/util/ListSet.java b/server/src/com/vaadin/data/util/ListSet.java index 2563366229..55ef398b20 100644 --- a/server/src/com/vaadin/data/util/ListSet.java +++ b/server/src/com/vaadin/data/util/ListSet.java @@ -82,7 +82,7 @@ public class ListSet<E> extends ArrayList<E> { } else { return false; } - }; + } /** * Works as java.util.ArrayList#add(int, java.lang.Object) but returns diff --git a/server/src/com/vaadin/data/util/MethodProperty.java b/server/src/com/vaadin/data/util/MethodProperty.java index 3cba8c2eab..d7323d872f 100644 --- a/server/src/com/vaadin/data/util/MethodProperty.java +++ b/server/src/com/vaadin/data/util/MethodProperty.java @@ -19,6 +19,7 @@ package com.vaadin.data.util; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; @@ -85,6 +86,10 @@ public class MethodProperty<T> extends AbstractProperty<T> { */ private transient Class<? extends T> type; + private static final Object[] DEFAULT_GET_ARGS = new Object[0]; + + private static final Object[] DEFAULT_SET_ARGS = new Object[1]; + /* Special serialization to handle method references */ private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); @@ -108,7 +113,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { out.writeObject(null); out.writeObject(null); } - }; + } /* Special serialization to handle method references */ private void readObject(java.io.ObjectInputStream in) throws IOException, @@ -120,8 +125,9 @@ public class MethodProperty<T> extends AbstractProperty<T> { Class<T> class1 = (Class<T>) SerializerHelper.readClass(in); type = class1; instance = in.readObject(); - setArgs = (Object[]) in.readObject(); - getArgs = (Object[]) in.readObject(); + Object[] setArgs = (Object[]) in.readObject(); + Object[] getArgs = (Object[]) in.readObject(); + setArguments(getArgs, setArgs, setArgumentIndex); String name = (String) in.readObject(); Class<?>[] paramTypes = SerializerHelper.readClassArray(in); if (name != null) { @@ -142,7 +148,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { } catch (NoSuchMethodException e) { getLogger().log(Level.SEVERE, "Internal deserialization error", e); } - }; + } /** * <p> @@ -219,7 +225,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { type = (Class<T>) returnType; } - setArguments(new Object[] {}, new Object[] { null }, 0); + setArguments(DEFAULT_GET_ARGS, DEFAULT_SET_ARGS, 0); this.instance = instance; } @@ -627,13 +633,15 @@ public class MethodProperty<T> extends AbstractProperty<T> { */ public void setArguments(Object[] getArgs, Object[] setArgs, int setArgumentIndex) { - this.getArgs = new Object[getArgs.length]; - for (int i = 0; i < getArgs.length; i++) { - this.getArgs[i] = getArgs[i]; + if (getArgs.length == 0) { + this.getArgs = DEFAULT_GET_ARGS; + } else { + this.getArgs = Arrays.copyOf(getArgs, getArgs.length); } - this.setArgs = new Object[setArgs.length]; - for (int i = 0; i < setArgs.length; i++) { - this.setArgs[i] = setArgs[i]; + if (Arrays.equals(setArgs, DEFAULT_SET_ARGS)) { + this.setArgs = DEFAULT_SET_ARGS; + } else { + this.setArgs = Arrays.copyOf(setArgs, setArgs.length); } this.setArgumentIndex = setArgumentIndex; } diff --git a/server/src/com/vaadin/data/util/MethodPropertyDescriptor.java b/server/src/com/vaadin/data/util/MethodPropertyDescriptor.java index 7caebac317..007fdc4adc 100644 --- a/server/src/com/vaadin/data/util/MethodPropertyDescriptor.java +++ b/server/src/com/vaadin/data/util/MethodPropertyDescriptor.java @@ -122,7 +122,7 @@ public class MethodPropertyDescriptor<BT> implements } catch (NoSuchMethodException e) { getLogger().log(Level.SEVERE, "Internal deserialization error", e); } - }; + } @Override public String getName() { diff --git a/server/src/com/vaadin/data/util/filter/Compare.java b/server/src/com/vaadin/data/util/filter/Compare.java index ac167673bd..1396c46d36 100644 --- a/server/src/com/vaadin/data/util/filter/Compare.java +++ b/server/src/com/vaadin/data/util/filter/Compare.java @@ -37,7 +37,7 @@ public abstract class Compare implements Filter { public enum Operation { EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL - }; + } private final Object propertyId; private final Operation operation; |