- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.time.YearMonth.from()
方法的一些代码示例,展示了YearMonth.from()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.from()
方法的具体详情如下:
包路径:java.time.YearMonth
类名称:YearMonth
方法名:from
[英]Obtains an instance of YearMonth from a temporal object.
A TemporalAccessor represents some form of date and time information. This factory converts the arbitrary temporal object to an instance of YearMonth.
The conversion extracts the ChronoField#YEAR and ChronoField#MONTH_OF_YEAR fields. The extraction is only permitted if the temporal object has an ISO chronology, or can be converted to a LocalDate.
This method matches the signature of the functional interface TemporalQueryallowing it to be used in queries via method reference, YearMonth::from.
[中]从时间对象获取YearMonth的实例。
临时助理代表某种形式的日期和时间信息。该工厂将任意时态对象转换为YearMonth的实例。
转换将提取ChronoField#YEAR和ChronoField#MONTH_OF_YEAR字段。仅当时态对象具有ISO年表或可以转换为LocalDate时,才允许提取。
此方法匹配函数接口TemporalQueryLow的签名,通过方法引用YearMonth::from将其用于查询。
代码示例来源:origin: jfoenixadmin/JFoenix
void clearFocus() {
LocalDate focusDate = datePicker.getValue();
if (focusDate == null) {
focusDate = LocalDate.now();
}
if (YearMonth.from(focusDate).equals(selectedYearMonth.get())) {
goToDate(focusDate, true);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
private void goToDate(LocalDate date, boolean focusDayCell) {
if (isValidDate(datePicker.getChronology(), date)) {
selectedYearMonth.set(YearMonth.from(date));
if (focusDayCell) {
findDayCellOfDate(date).requestFocus();
}
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
YearMonth.from(date) : YearMonth.now());
content.updateValues();
LocalDate date = jfxDatePicker.getValue();
content.displayedYearMonthProperty().set((date != null) ?
YearMonth.from(date) : YearMonth.now());
content.updateValues();
代码示例来源:origin: jfoenixadmin/JFoenix
selectedYearMonth.set((date != null) ? YearMonth.from(date) : YearMonth.now());
selectedYearMonth.addListener((observable, oldValue, newValue) -> updateValues());
代码示例来源:origin: com.github.seratch/java-time-backport
@Override
public YearMonth queryFrom(TemporalAccessor temporal) {
return YearMonth.from(temporal);
}
};
代码示例来源:origin: OpenGamma/Strata
@Override
public DatedParameterMetadata metadata(LocalDate valuationDate, ReferenceData refData) {
LocalDate nodeDate = date(valuationDate, refData);
LocalDate referenceDate = template.calculateReferenceDateFromTradeDate(valuationDate, refData);
if (label.isEmpty()) {
return YearMonthDateParameterMetadata.of(nodeDate, YearMonth.from(referenceDate));
}
return YearMonthDateParameterMetadata.of(nodeDate, YearMonth.from(referenceDate), label);
}
代码示例来源:origin: vladmihalcea/high-performance-java-persistence
@Override
public YearMonth convertToEntityAttribute(java.sql.Date dbData) {
return YearMonth.from(Instant.ofEpochMilli(dbData.getTime())
.atZone(ZoneId.systemDefault())
.toLocalDate());
}
}
代码示例来源:origin: com.jfoenix/jfoenix
void clearFocus() {
LocalDate focusDate = datePicker.getValue();
if (focusDate == null) {
focusDate = LocalDate.now();
}
if (YearMonth.from(focusDate).equals(selectedYearMonth.get())) {
goToDate(focusDate, true);
}
}
代码示例来源:origin: OpenGamma/Strata
@Override
public double value(PriceIndexObservation observation) {
YearMonth fixingMonth = observation.getFixingMonth();
// If fixing in the past, check time series and returns the historic month price index if present
if (fixingMonth.isBefore(YearMonth.from(valuationDate))) {
OptionalDouble fixing = fixings.get(fixingMonth.atEndOfMonth());
if (fixing.isPresent()) {
return fixing.getAsDouble();
}
}
throw new MarketDataNotFoundException("Unable to query forward value for historic index " + index);
}
代码示例来源:origin: com.jfoenix/jfoenix
private void goToDate(LocalDate date, boolean focusDayCell) {
if (isValidDate(datePicker.getChronology(), date)) {
selectedYearMonth.set(YearMonth.from(date));
if (focusDayCell) {
findDayCellOfDate(date).requestFocus();
}
}
}
代码示例来源:origin: OpenGamma/Strata
@Test(dataProvider = "quarterly10th")
public void test_nextOrSameQuarterly10th(LocalDate base, LocalDate expect1, LocalDate expect2, LocalDate expect3) {
LocalDate date = base.plusDays(1);
while (!date.isAfter(expect1)) {
assertEquals(DateSequences.QUARTERLY_10TH.nextOrSame(date), expect1);
assertEquals(DateSequences.QUARTERLY_10TH.nthOrSame(date, 1), expect1);
assertEquals(DateSequences.QUARTERLY_10TH.nthOrSame(date, 2), expect2);
assertEquals(DateSequences.QUARTERLY_10TH.nthOrSame(date, 3), expect3);
date = date.plusDays(1);
}
assertEquals(DateSequences.QUARTERLY_10TH.dateMatching(YearMonth.from(date)), expect1);
}
代码示例来源:origin: OpenGamma/Strata
@Test(dataProvider = "monthlyImm")
public void test_nextOrSameMonthlyImm(LocalDate base, LocalDate immDate1, LocalDate immDate2, LocalDate immDate3) {
LocalDate date = base.plusDays(1);
while (!date.isAfter(immDate1)) {
assertEquals(DateSequences.MONTHLY_IMM.nextOrSame(date), immDate1);
assertEquals(DateSequences.MONTHLY_IMM.nthOrSame(date, 1), immDate1);
assertEquals(DateSequences.MONTHLY_IMM.nthOrSame(date, 2), immDate2);
assertEquals(DateSequences.MONTHLY_IMM.nthOrSame(date, 3), immDate3);
date = date.plusDays(1);
}
assertEquals(DateSequences.MONTHLY_IMM.dateMatching(YearMonth.from(date)), immDate1);
}
代码示例来源:origin: OpenGamma/Strata
@Test(dataProvider = "quarterlyImm")
public void test_nextOrSameQuarterlyImm(LocalDate base, LocalDate immDate1, LocalDate immDate2, LocalDate immDate3) {
LocalDate date = base.plusDays(1);
while (!date.isAfter(immDate1)) {
assertEquals(DateSequences.QUARTERLY_IMM.nextOrSame(date), immDate1);
assertEquals(DateSequences.QUARTERLY_IMM.nthOrSame(date, 1), immDate1);
assertEquals(DateSequences.QUARTERLY_IMM.nthOrSame(date, 2), immDate2);
assertEquals(DateSequences.QUARTERLY_IMM.nthOrSame(date, 3), immDate3);
date = date.plusDays(1);
}
assertEquals(DateSequences.QUARTERLY_IMM.dateMatching(YearMonth.from(date)), immDate1);
}
代码示例来源:origin: OpenGamma/Strata
@Override
public PointSensitivityBuilder valuePointSensitivity(PriceIndexObservation observation) {
YearMonth fixingMonth = observation.getFixingMonth();
// If fixing in the past, check time series and returns the historic month price index if present
if (fixingMonth.isBefore(YearMonth.from(valuationDate))) {
if (fixings.get(fixingMonth.atEndOfMonth()).isPresent()) {
return PointSensitivityBuilder.none();
}
}
throw new MarketDataNotFoundException("Unable to query forward value sensitivity for historic index " + index);
}
代码示例来源:origin: OpenGamma/Strata
@Override
public PointSensitivityBuilder valuePointSensitivity(PriceIndexObservation observation) {
YearMonth fixingMonth = observation.getFixingMonth();
// If fixing in the past, check time series and returns the historic month price index if present
if (fixingMonth.isBefore(YearMonth.from(valuationDate))) {
if (fixings.get(fixingMonth.atEndOfMonth()).isPresent()) {
return PointSensitivityBuilder.none();
}
}
return InflationRateSensitivity.of(observation, 1d);
}
代码示例来源:origin: OpenGamma/Strata
public void test_metadata_end() {
IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL);
LocalDate date = LocalDate.of(2015, 10, 20);
LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(date, REF_DATA);
LocalDate maturityDate = TEMPLATE.getIndex().calculateMaturityFromEffective(referenceDate, REF_DATA);
ParameterMetadata metadata = node.metadata(date, REF_DATA);
assertEquals(metadata.getLabel(), LABEL);
assertTrue(metadata instanceof YearMonthDateParameterMetadata);
assertEquals(((YearMonthDateParameterMetadata) metadata).getDate(), maturityDate);
assertEquals(((YearMonthDateParameterMetadata) metadata).getYearMonth(), YearMonth.from(referenceDate));
}
代码示例来源:origin: OpenGamma/Strata
private UnitParameterSensitivities unitParameterSensitivity(YearMonth month) {
// If fixing in the past, check time series and returns the historic month price index if present
if (month.isBefore(YearMonth.from(valuationDate))) {
if (fixings.get(month.atEndOfMonth()).isPresent()) {
return UnitParameterSensitivities.empty();
}
}
double nbMonth = numberOfMonths(month);
return UnitParameterSensitivities.of(curve.yValueParameterSensitivity(nbMonth));
}
代码示例来源:origin: OpenGamma/Strata
public void value_multiplicative() {
InflationNodalCurve curveComputed = InflationNodalCurve.of(CURVE_NOFIX, VAL_DATE_2, LAST_FIX_MONTH_2, LAST_FIX_VALUE,
SEASONALITY_MULTIPLICATIVE_DEF);
for (int i = 1; i < TEST_MONTHS.length; i++) {
double nbMonths = YearMonth.from(VAL_DATE_2).until(TEST_MONTHS[i], MONTHS);
double valueComputed = curveComputed.yValue(nbMonths);
int x = (int) ((nbMonths + 12) % 12);
double valueNoAdj = EXTENDED_CURVE_2.yValue(nbMonths);
double adj = SEASONALITY_MULTIPLICATIVE_COMP_2.get(x);
double valueExpected = valueNoAdj * adj;
assertEquals(valueExpected, valueComputed, TOLERANCE_VALUE);
}
}
代码示例来源:origin: OpenGamma/Strata
public void test_metadata_last_fixing() {
IborFutureCurveNode node =
IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING);
ImmutableMarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, 0.0d).build();
IborFutureTrade trade = node.trade(1d, marketData, REF_DATA);
LocalDate fixingDate = trade.getProduct().getFixingDate();
DatedParameterMetadata metadata = node.metadata(VAL_DATE, REF_DATA);
assertEquals(metadata.getDate(), fixingDate);
LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(VAL_DATE, REF_DATA);
assertEquals(((YearMonthDateParameterMetadata) metadata).getYearMonth(), YearMonth.from(referenceDate));
}
代码示例来源:origin: OpenGamma/Strata
public void test_value_pts_sensitivity_futfixing() {
for (int i = 0; i < TEST_MONTHS.length; i++) {
PointSensitivityBuilder ptsComputed = INSTANCE_WITH_FUTFIXING.valuePointSensitivity(TEST_OBS[i]);
YearMonth fixingMonth = TEST_OBS[i].getFixingMonth();
PointSensitivityBuilder ptsExpected;
if (fixingMonth.isBefore(YearMonth.from(VAL_DATE_2)) && USCPI_TS.containsDate(fixingMonth.atEndOfMonth())) {
ptsExpected = PointSensitivityBuilder.none();
} else {
ptsExpected = InflationRateSensitivity.of(TEST_OBS[i], 1d);
}
assertTrue(ptsComputed.build().equalWithTolerance(ptsExpected.build(), TOLERANCE_VALUE), "test " + i);
}
}
此 map-reduce 用于计算“Hadoop:权威指南”中的示例每年和每月的平均温度 输出应该是 年[TAB]月[TAB]平均_温度 由于键(年+月)已经合并,是否可以使用 substring()
我想解析两个单独的字符串 "1982"和"SEP"进入java.time.YearMonth对象。 java.time.YearMonth.parse("1978 SEP", java.time.fo
在.Net Framework中,我们常用的时间类型是DateTime。直到.Net6微软加入了两个新的时间类型:DateOnly和TimeOnly,才弥补了之前的不足。 DateOnly :
本文整理了Java中java.time.YearMonth.with()方法的一些代码示例,展示了YearMonth.with()的具体用法。这些代码示例主要来源于Github/Stackoverfl
本文整理了Java中java.time.YearMonth.until()方法的一些代码示例,展示了YearMonth.until()的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中java.time.YearMonth.from()方法的一些代码示例,展示了YearMonth.from()的具体用法。这些代码示例主要来源于Github/Stackoverfl
本文整理了Java中java.time.YearMonth.of()方法的一些代码示例,展示了YearMonth.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
我正在使用 joda.time 的 YearMonth 对象,并希望在此对象中获取月份日期的最后一天。 yearMonth.monthOfYear().getMaximumValue(); //ret
我想找到等于或晚于当前 YearMonth 的月份 final YearMonth yearMonth = YearMonth.of(2020, 8); final boolean after = y
如何在实体中使用 YearMonth?我已经看到很多关于转换器的堆栈溢出答案?这仍然需要吗?如果需要的话如何? @Basic(optional = false) @NotNull @Column(na
我在解析代表年份和月份的特殊字符串时遇到问题,偏移量如下:2014-08+03:00 . 所需的输出是 YearMonth . 我已经测试过创建自定义 DateTimeFormatter有各种模式,但
本文整理了Java中java.time.YearMonth.()方法的一些代码示例,展示了YearMonth.()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
本文整理了Java中java.time.YearMonth.compareTo()方法的一些代码示例,展示了YearMonth.compareTo()的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中java.time.YearMonth.lengthOfMonth()方法的一些代码示例,展示了YearMonth.lengthOfMonth()的具体用法。这些代码示例主要来源于
本文整理了Java中java.time.YearMonth.minusMonths()方法的一些代码示例,展示了YearMonth.minusMonths()的具体用法。这些代码示例主要来源于Gith
本文整理了Java中java.time.YearMonth.now()方法的一些代码示例,展示了YearMonth.now()的具体用法。这些代码示例主要来源于Github/Stackoverflow
本文整理了Java中java.time.YearMonth.isBefore()方法的一些代码示例,展示了YearMonth.isBefore()的具体用法。这些代码示例主要来源于Github/Sta
本文整理了Java中java.time.YearMonth.getMonth()方法的一些代码示例,展示了YearMonth.getMonth()的具体用法。这些代码示例主要来源于Github/Sta
本文整理了Java中java.time.YearMonth.format()方法的一些代码示例,展示了YearMonth.format()的具体用法。这些代码示例主要来源于Github/Stackov
本文整理了Java中java.time.YearMonth.plus()方法的一些代码示例,展示了YearMonth.plus()的具体用法。这些代码示例主要来源于Github/Stackoverfl
我是一名优秀的程序员,十分优秀!