本文整理匯總了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[]{});
}