本文整理匯總了Java中java.time.YearMonth.from方法的典型用法代碼示例。如果您正苦於以下問題:Java YearMonth.from方法的具體用法?Java YearMonth.from怎麽用?Java YearMonth.from使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.time.YearMonth
的用法示例。
在下文中一共展示了YearMonth.from方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyStyles
import java.time.YearMonth; //導入方法依賴的package包/類
private void applyStyles() {
YearMonth yearMonth;
if (date == null) {
// date can be null if cell is used to fill the month column
return;
}
yearMonth = YearMonth.from(date);
if (view.isExtendedMonth(yearMonth)) {
getStyleClass().add(EXTENDED_CELL_STYLE_CLASS);
}
WeekFields fields = view.getWeekFields();
DayOfWeek firstDayOfWeek = fields.getFirstDayOfWeek();
if (date.getDayOfWeek().equals(firstDayOfWeek)) {
getStyleClass().add(FIRST_DAY_OF_WEEK);
}
if (view.getWeekendDays().contains(date.getDayOfWeek())) {
if (!getStyleClass().contains(WEEKEND_DAY)) {
getStyleClass().add(0, WEEKEND_DAY);
}
} else {
getStyleClass().remove(WEEKEND_DAY);
}
getStyleClass().add(date.getDayOfWeek().name().toLowerCase());
}
示例2: getEndMonth
import java.time.YearMonth; //導入方法依賴的package包/類
@Override
public YearMonth getEndMonth(LocalDate date) {
return YearMonth.from(date);
}
示例3: getYearMonth
import java.time.YearMonth; //導入方法依賴的package包/類
public YearMonth getYearMonth() {
return value == null ? null : YearMonth.from(value.toInstant().atZone(zoneId));
}
示例4: test_from_TemporalAccessor_invalid_noDerive
import java.time.YearMonth; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void test_from_TemporalAccessor_invalid_noDerive() {
YearMonth.from(LocalTime.of(12, 30));
}
示例5: test_from_TemporalAccessor_null
import java.time.YearMonth; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void test_from_TemporalAccessor_null() {
YearMonth.from((TemporalAccessor) null);
}
示例6: getStartMonth
import java.time.YearMonth; //導入方法依賴的package包/類
@Override
public YearMonth getStartMonth(LocalDate date) {
return YearMonth.from(date);
}