本文整理了Java中play.libs.F
类的一些代码示例,展示了F
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。F
类的具体详情如下:
包路径:play.libs.F
类名称:F
[英]Defines a set of functional programming style helpers.
[中]定义一组函数式编程样式帮助器。
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* 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());
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* 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());
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
/**
* 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);
}
代码示例来源:origin: play/play-java
@SuppressWarnings("unchecked")
public Form(String name, Class<T> clazz) {
this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), null);
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
@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);
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
public static <A, B, C> E3<A, B, C> _3(C value) {
return new E3(None, None, Some(value));
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
@SuppressWarnings("unchecked")
public Form(String name, Class<T> clazz) {
this(name, clazz, new HashMap<String,String>(), new HashMap<String,List<ValidationError>>(), None(), null);
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* 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());
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
public static <A, B, C, D> E4<A, B, C, D> _3(C value) {
return new E4(None, None, Some(value), None);
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* 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));
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
@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);
}
代码示例来源:origin: com.typesafe.play/play
/**
* 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());
}
代码示例来源:origin: play/play-java
/**
* 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);
}
代码示例来源:origin: play/play-java
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);
代码示例来源:origin: play/play-java
@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);
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* 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());
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
public static <A, B> Either<A, B> _2(B value) {
return new Either(None, Some(value));
}
代码示例来源:origin: com.typesafe.play/play-java-forms
@Override
public Tuple<String, Object[]> getErrorMessageKey() {
return Tuple(message, new Object[] { regex });
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
public static <A, B> Either<A, B> _1(A value) {
return new Either(Some(value), None);
}
代码示例来源:origin: com.typesafe.play/play-java-forms_2.12
@Override
public Tuple<String, Object[]> getErrorMessageKey() {
return Tuple(message, new Object[] { regex });
}
内容来源于网络,如有侵权,请联系作者删除!