/** * Constructs a right side of the disjoint union, as opposed to the Left side. * * @param value The value of the right side * @return A right sided disjoint union */ public static <A, B> Either<A, B> Right(B value) { return new Either<A, B>(None(), Some(value)); }
/** * Constructs a left side of the disjoint union, as opposed to the Right side. * * @param value The value of the left side * @return A left sided disjoint union */ public static <A, B> Either<A, B> Left(A value) { return new Either<A, B>(Some(value), None()); }
public static <A, B> Either<A, B> _2(B value) { return new Either(None, Some(value)); }
/** * 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); }
/** * 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); }
public static <A, B> Either<A, B> _1(A value) { return new Either(Some(value), None); }
public static <A, B, C> E3<A, B, C> _1(A value) { return new E3(Some(value), None, None); }
public static <A, B, C> E3<A, B, C> _2(B value) { return new E3(None, Some(value), None); }
public static <A, B, C, D> E4<A, B, C, D> _2(B value) { return new E4(None, Some(value), None, None); }
public static <A, B, C> E3<A, B, C> _3(C value) { return new E3(None, None, Some(value)); }
public static <A, B, C, D> E4<A, B, C, D> _3(C value) { return new E4(None, None, Some(value), None); }
public static <A, B, C, D> E4<A, B, C, D> _4(D value) { return new E4(None, None, None, Some(value)); }
return new Form(rootName, backedType, new HashMap<String,String>(data), new HashMap<String,List<ValidationError>>(errors), Some((T)result.getTarget()), groups);
return new Form(rootName, backedType, data, errors, Some((T)result.getTarget()), groups); } else { Object globalError = null; errors = (Map<String,List<ValidationError>>)globalError; return new Form(rootName, backedType, data, errors, Some((T)result.getTarget()), groups); return new Form(rootName, backedType, new HashMap<String,String>(data), new HashMap<String,List<ValidationError>>(errors), Some((T)result.getTarget()), groups);