Permalink
Browse files

[#331] re-introducing some old methods which where lost in the binder…

…-refactoring. They need to be there to be compatible with modules.
  • Loading branch information...
1 parent 1ac31eb commit 944fc9d22ae6e686c3d98f338e3389942c4baf68 @mbknor mbknor committed Sep 23, 2011
Showing with 64 additions and 0 deletions.
  1. +28 −0 framework/src/play/data/binding/Binder.java
  2. +36 −0 framework/src/play/db/jpa/GenericModel.java
@@ -81,6 +81,12 @@ public MethodAndParamInfo(Object objectInstance, Method method, int parameterInd
}
}
+ @Deprecated
+ public static Object bind(String name, Class<?> clazz, Type type, Annotation[] annotations, Map<String, String[]> params) {
+ RootParamNode parentParamNode = RootParamNode.convert(params);
+ return bind(parentParamNode, name, clazz, type, annotations);
+ }
+
public static Object bind( RootParamNode parentParamNode, String name, Class<?> clazz, Type type, Annotation[] annotations) {
return bind(parentParamNode, name, clazz, type, annotations, null);
}
@@ -448,11 +454,33 @@ private static Object bindCollection(Class<?> clazz, Type type, ParamNode paramN
return r;
}
+
+
public static Object directBind(String value, Class<?> clazz) throws Exception {
return directBind(null, value, clazz, null);
}
+ /**
+ * This method is deprecated - name parameter not needed. Use this instead:
+ *
+ * public static Object directBind(Annotation[] annotations, String value, Class<?> clazz, Type type) throws Exception
+ */
+ @Deprecated
+ public static Object directBind(String name, Annotation[] annotations, String value, Class<?> clazz) throws Exception {
+ return directBind(annotations, value, clazz, null);
+ }
+
+ /**
+ * This method is deprecated - name parameter not needed. Use this instead:
+ *
+ * public static Object directBind(Annotation[] annotations, String value, Class<?> clazz, Type type) throws Exception
+ */
+ @Deprecated
+ public static Object directBind(String name, Annotation[] annotations, String value, Class<?> clazz, Type type) throws Exception {
+ return directBind(annotations, value, clazz, type);
+ }
+
@SuppressWarnings("unchecked")
public static Object directBind(Annotation[] annotations, String value, Class<?> clazz, Type type) throws Exception {
boolean nullOrEmpty = value == null || value.trim().length() == 0;
@@ -8,6 +8,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.persistence.*;
@@ -31,6 +32,17 @@
@SuppressWarnings("unchecked")
public class GenericModel extends JPABase {
+ /**
+ * This method is deprecated. Use this instead:
+ *
+ * public static <T extends JPABase> T create(ParamNode rootParamNode, String name, Class<?> type, Annotation[] annotations)
+ */
+ @Deprecated
+ public static <T extends JPABase> T create(Class<?> type, String name, Map<String, String[]> params, Annotation[] annotations) {
+ ParamNode rootParamNode = ParamNode.convert(params);
+ return create(rootParamNode, name, type, annotations);
+ }
+
public static <T extends JPABase> T create(ParamNode rootParamNode, String name, Class<?> type, Annotation[] annotations) {
try {
Constructor c = type.getDeclaredConstructor();
@@ -42,6 +54,19 @@
}
}
+ /**
+ * This method is deprecated. Use this instead:
+ *
+ * public static <T extends JPABase> T edit(ParamNode rootParamNode, String name, Object o, Annotation[] annotations)
+ *
+ * @return
+ */
+ @Deprecated
+ public static <T extends JPABase> T edit(Object o, String name, Map<String, String[]> params, Annotation[] annotations) {
+ ParamNode rootParamNode = ParamNode.convert(params);
+ return edit( rootParamNode, name, o, annotations);
+ }
+
@SuppressWarnings("deprecation")
public static <T extends JPABase> T edit(ParamNode rootParamNode, String name, Object o, Annotation[] annotations) {
@@ -146,6 +171,17 @@
}
}
+ /**
+ * This method is deprecated. Use this instead:
+ *
+ * public <T extends GenericModel> T edit(ParamNode rootParamNode, String name)
+ */
+ @Deprecated
+ public <T extends GenericModel> T edit(String name, Map<String, String[]> params) {
+ ParamNode rootParamNode = ParamNode.convert(params);
+ return edit(rootParamNode, name, this, null);
+ }
+
public <T extends GenericModel> T edit(ParamNode rootParamNode, String name) {
edit(rootParamNode, name, this, null);
return (T) this;

0 comments on commit 944fc9d

Please sign in to comment.