本文整理汇总了Java中play.libs.F.Option方法的典型用法代码示例。如果您正苦于以下问题:Java F.Option方法的具体用法?Java F.Option怎么用?Java F.Option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.libs.F
的用法示例。
在下文中一共展示了F.Option方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSomeToArray
import play.libs.F; //导入方法依赖的package包/类
@Test
public void testSomeToArray() {
F.Option<String> a = Option.Some("a");
assertThat(a.toArray()).isEqualTo(new Object[]{"a"});
assertThat(a.toArray(new String[]{})).isEqualTo(new String[]{"a"});
assertThat(a.toArray(new CharSequence[]{})).isEqualTo(new String[]{"a"});
String[] b = {null, "b", null , "c"};
assertThat(a.toArray(b)).isEqualTo(new String[]{"a", null, null, null});
}
示例2: testNoneToArray
import play.libs.F; //导入方法依赖的package包/类
@Test
public void testNoneToArray() {
F.Option<String> a = Option.<String>None();
assertThat(a.toArray()).isEqualTo(new Object[]{});
assertThat(a.toArray(new String[]{})).isEqualTo(new String[]{});
assertThat(a.toArray(new CharSequence[]{})).isEqualTo(new String[]{});
String[] b = {null, "b", null , "c"};
assertThat(a.toArray(b)).isEqualTo(new String[]{null, null, null, null});
}
示例3: bind
import play.libs.F; //导入方法依赖的package包/类
@Override
public F.Option<Pager> bind(String key, Map<String, String[]> data) {
if (data.containsKey(key + ".index") && data.containsKey(key + ".size")) {
try {
index = Integer.parseInt(data.get(key + ".index")[0]);
size = Integer.parseInt(data.get(key + ".size")[0]);
return F.Option.Some(this);
} catch (NumberFormatException e) {
return F.Option.None();
}
} else {
return F.Option.None();
}
}
示例4: setCompany
import play.libs.F; //导入方法依赖的package包/类
public void setCompany(F.Option<String> company) {
this.company = company;
}
示例5: getCompany
import play.libs.F; //导入方法依赖的package包/类
public F.Option<String> getCompany() {
return company;
}
示例6: throwArrayStoreException
import play.libs.F; //导入方法依赖的package包/类
@Test(expected=ArrayStoreException.class)
public void throwArrayStoreException() {
F.Option<String> a = Option.Some("a");
a.toArray(new Integer[]{});
}