/** * Converts a scala {@code Tuple2} to a java F.Tuple. * * @param tuple the Scala Tuple. * @param <A> input parameter type * @param <B> return type. * @return an instance of Tuple with the elements. */ public static <A, B> F.Tuple<A, B> asJava(scala.Tuple2<A, B> tuple) { return F.Tuple(tuple._1(), tuple._2()); }
/** * Populates this form with an existing value, used for edit forms. * * @param value existing value of type <code>T</code> used to fill this form * @return a copy of this form filled with the new data */ @SuppressWarnings("unchecked") public Form<T> fill(T value) { if(value == null) { throw new RuntimeException("Cannot fill a form with a null value"); } return new Form(rootName, backedType, new HashMap<String,String>(), new HashMap<String,ValidationError>(), Some(value), groups); }
@SuppressWarnings("unchecked") public Form(String name, Class<T> clazz) { this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), null); }
@SuppressWarnings("unchecked") public static void attachDataSource(DataSource dataSource, String name, String description, String disposition) { Map<String, Object> map = infos.get(); if (map == null) { throw new UnexpectedException("Mailer not instrumented ?"); } List<T4<DataSource, String, String, String>> datasourceList = (List<T4<DataSource, String, String, String>>) map.get("datasources"); if (datasourceList == null) { datasourceList = new ArrayList<>(); map.put("datasources", datasourceList); } datasourceList.add(F.T4(dataSource, name, description, disposition)); infos.set(map); }
public static <A, B, C> E3<A, B, C> _3(C value) { return new E3(None, None, Some(value)); }
@SuppressWarnings("unchecked") public Form(String name, Class<T> clazz) { this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), null); }
/** * Converts a scala {@code Tuple2} to a java F.Tuple. * * @param tuple the Scala Tuple. * @param <A> input parameter type * @param <B> return type. * @return an instance of Tuple with the elements. */ public static <A, B> F.Tuple<A, B> asJava(scala.Tuple2<A, B> tuple) { return F.Tuple(tuple._1(), tuple._2()); }
public static <A, B, C, D> E4<A, B, C, D> _3(C value) { return new E4(None, None, Some(value), None); }
@SuppressWarnings("unchecked") public Form(String name, Class<T> clazz, Class<?> groups) { this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), groups); }
/** * Converts a scala {@code Tuple2} to a java F.Tuple. * * @param tuple the Scala Tuple. * @param <A> input parameter type * @param <B> return type. * @return an instance of Tuple with the elements. */ public static <A, B> F.Tuple<A, B> asJava(scala.Tuple2<A, B> tuple) { return F.Tuple(tuple._1(), tuple._2()); }
/** * Populates this form with an existing value, used for edit forms. * * @param value existing value of type <code>T</code> used to fill this form * @return a copy of this form filled with the new data */ @SuppressWarnings("unchecked") public Form<T> fill(T value) { if(value == null) { throw new RuntimeException("Cannot fill a form with a null value"); } return new Form(rootName, backedType, new HashMap<String,String>(), new HashMap<String,ValidationError>(), Some(value), groups); }
return new Form(rootName, backedType, data, errors, None(), groups); } else { Object globalError = null; errors = (Map<String,List<ValidationError>>)globalError; return new Form(rootName, backedType, data, errors, None(), groups); return new Form(rootName, backedType, new HashMap<String,String>(data), new HashMap<String,List<ValidationError>>(errors), Some((T)result.getTarget()), groups);
@SuppressWarnings("unchecked") public Form(String name, Class<T> clazz, Class<?> groups) { this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), groups); }
/** * Convert a scala Tuple2 to a java F.Tuple. */ public static <A, B> F.Tuple<A, B> asJava(scala.Tuple2<A, B> tuple) { return F.Tuple(tuple._1(), tuple._2()); }
public static <A, B> Either<A, B> _2(B value) { return new Either(None, Some(value)); }
@Override public Tuple<String, Object[]> getErrorMessageKey() { return Tuple(message, new Object[] { regex }); }
public static <A, B> Either<A, B> _1(A value) { return new Either(Some(value), None); }
@Override public Tuple<String, Object[]> getErrorMessageKey() { return Tuple(message, new Object[] { regex }); }