/** * 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()); }
/** * 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()); }
/** * 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()); }
/** * 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()); }
@Override public Tuple<String, Object[]> getErrorMessageKey() { return Tuple(message, new Object[] { regex }); }
@Override public Tuple<String, Object[]> getErrorMessageKey() { return Tuple(message, new Object[] { regex }); }
public Tuple<String, Object[]> getErrorMessageKey() { return Tuple(message, new Object[] {}); }
@SuppressWarnings("unchecked") public Tuple<String, Object[]> getErrorMessageKey() { Tuple<String, Object[]> errorMessageKey = null; try { errorMessageKey = validator.getErrorMessageKey(); } catch(Exception e) { throw new RuntimeException(e); } return (errorMessageKey != null) ? errorMessageKey : Tuple(defaultMessage, new Object[] {}); }
@SuppressWarnings("unchecked") public Tuple<String, Object[]> getErrorMessageKey() { Tuple<String, Object[]> errorMessageKey = null; try { errorMessageKey = validator.getErrorMessageKey(); } catch(Exception e) { throw new RuntimeException(e); } return (errorMessageKey != null) ? errorMessageKey : Tuple(defaultMessage, new Object[] {}); }
@SuppressWarnings("unchecked") public Tuple<String, Object[]> getErrorMessageKey() { Tuple<String, Object[]> errorMessageKey = null; try { errorMessageKey = validator.getErrorMessageKey(); } catch(Exception e) { throw new RuntimeException(e); } return (errorMessageKey != null) ? errorMessageKey : Tuple(defaultMessage, new Object[] {}); }
@SuppressWarnings("unchecked") public Tuple<String, Object[]> getErrorMessageKey() { Tuple<String, Object[]> errorMessageKey = null; try { errorMessageKey = validator.getErrorMessageKey(); } catch(Exception e) { throw new RuntimeException(e); } return (errorMessageKey != null) ? errorMessageKey : Tuple(defaultMessage, new Object[] {}); }
@SuppressWarnings("unchecked") public Tuple<String, Object[]> getErrorMessageKey() { Tuple<String, Object[]> errorMessageKey = null; try { errorMessageKey = validator.getErrorMessageKey(); } catch(Exception e) { throw new RuntimeException(e); } return (errorMessageKey != null) ? errorMessageKey : Tuple(defaultMessage, new Object[] {}); }
public CompletionStage<F.Tuple<Optional<Result>, Http.RequestHeader>> preAuth(final boolean forcePreAuthCheck, final Http.RequestHeader request, final Optional<String> content, final DeadboltHandler deadboltHandler) { return forcePreAuthCheck ? beforeAuthCheckCache.apply(deadboltHandler, request, content) : CompletableFuture.completedFuture(F.Tuple(Optional.empty(), request)); }
/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
/** * Converts a constraint to a human-readable value. * * @param constraint the constraint descriptor. * @return A tuple containing the constraint's display name and the constraint attributes. */ public static Tuple<String,List<Object>> displayableConstraint(ConstraintDescriptor<?> constraint) { final Display displayAnnotation = constraint.getAnnotation().annotationType().getAnnotation(Display.class); return Tuple(displayAnnotation.name(), Collections.unmodifiableList(Stream.of(displayAnnotation.attributes()).map(attr -> constraint.getAttributes().get(attr)).collect(Collectors.toList()))); }
/** * 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()); }
default Constraint or(final Constraint other) { Objects.requireNonNull(other); return (rh, handler, global, fMeta) -> test(rh, handler, global, fMeta).thenCompose(passed1 -> passed1._1 ? CompletableFuture.completedFuture(F.Tuple(true, passed1._2)) : other.test(passed1._2, handler, global, fMeta).thenApply(passed2 -> passed2)); } }
default Constraint and(final Constraint other) { Objects.requireNonNull(other); return (rh, handler, global, fMeta) -> test(rh, handler, global, fMeta).thenCompose(passed1 -> passed1._1 ? other.test(passed1._2, handler, global, fMeta).thenApply(passed2 -> passed2) : CompletableFuture.completedFuture(F.Tuple(false, passed1._2))); }
default Constraint or(final Constraint other) { Objects.requireNonNull(other); return (rh, handler, global, fMeta) -> test(rh, handler, global, fMeta).thenCompose(passed1 -> passed1._1 ? CompletableFuture.completedFuture(F.Tuple(true, passed1._2)) : other.test(passed1._2, handler, global, fMeta).thenApply(passed2 -> passed2)); } }