List of usage examples for java.time LocalDate getMonth
public Month getMonth()
From source file:com.bdb.weather.display.summary.HighLowPanel.java
private void loadData(OHLCSeries series, SeriesInfo<T> info, List<SummaryRecord> records, int seriesIndex) { ObservableList<SummaryRecord> dataModel = FXCollections.observableList(records); dataTable.setItems(dataModel);//from w w w . ja v a2 s . c o m for (SummaryRecord record : records) { T avg = info.getAvgValue(record); T min = info.getMinValue(record); T max = info.getMaxValue(record); LocalDate date = record.getDate(); // TODO: Figure out how to create a time period based on the specified interval RegularTimePeriod period = null; switch (interval) { case DAY_INTERVAL: period = new Hour(seriesIndex * 4, date.getDayOfMonth(), date.getMonth().getValue(), date.getYear()); break; case MONTH_INTERVAL: period = new Day(seriesIndex * 4 + 1, date.getMonth().getValue(), date.getYear()); break; case YEAR_INTERVAL: period = new Year(date.getYear()); break; default: period = null; break; } if (avg != null && min != null && max != null) { series.add(period, avg.get(), max.get(), min.get(), min.get()); } } }
From source file:org.dozer.converters.LocalDateConverter.java
@Override public Object convert(Class destClass, Object srcObj) { LocalDate convertedValue = null; try {/*from w w w .j a v a 2 s . c o m*/ if (srcObj instanceof String) { convertedValue = LocalDate.parse((String) srcObj); } else { LocalDate srcObject = (LocalDate) srcObj; convertedValue = LocalDate.of(srcObject.getYear(), srcObject.getMonth(), srcObject.getDayOfMonth()); } } catch (Exception e) { MappingUtils.throwMappingException("Cannot convert [" + srcObj + "] to LocalDate.", e); } return convertedValue; }