本文整理汇总了Java中java.time.LocalTime.from方法的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.from方法的具体用法?Java LocalTime.from怎么用?Java LocalTime.from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.time.LocalTime
的用法示例。
在下文中一共展示了LocalTime.from方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseLineToInfo
import java.time.LocalTime; //导入方法依赖的package包/类
private InfoSchema parseLineToInfo(String line, LocalDate localDate) {
String[] columns = line.split(" \\| ");
Matcher matcher = mjlogPattern.matcher(columns[3]);
if (matcher.find()) {
String id = matcher.group(1);
if (this.databaseService.existsIdInINFO(id)) return null;
boolean isSanma = columns[2].substring(0, 1).equals("三");
boolean isTonnan = columns[2].substring(2, 3).equals("南");
int minute = Integer.parseInt(columns[1]);
String[] playerAndScore = columns[4].split(" ");
String[] players = new String[4];
int[] scores = new int[4];
for (int i = 0; i < playerAndScore.length; i++) {
Matcher playerMatcher = playerPattern.matcher(playerAndScore[i]);
if (playerMatcher.find()) {
players[i] = playerMatcher.group(1);
scores[i] = (int) Float.parseFloat(playerMatcher.group(2));
}
}
LocalTime localTime = LocalTime.from(DateTimeFormatter.ofPattern("HH:mm").parse(columns[0]));
LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime);
return new InfoSchema.Builder(id, isSanma, isTonnan, localDateTime,
players[0], players[1], players[2], players[3])
.minute(minute)
.firstScore(scores[0])
.secondScore(scores[1])
.thirdScore(scores[2])
.fourthScore(scores[3])
.build();
}
return null;
}
示例2: factory_from_TemporalAccessor_invalid_noDerive
import java.time.LocalTime; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void factory_from_TemporalAccessor_invalid_noDerive() {
LocalTime.from(LocalDate.of(2007, 7, 15));
}
示例3: factory_from_TemporalAccessor_null
import java.time.LocalTime; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void factory_from_TemporalAccessor_null() {
LocalTime.from((TemporalAccessor) null);
}