gpt4 book ai didi

java.time.YearMonth.of()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 00:56:40 27 4
gpt4 key购买 nike

本文整理了Java中java.time.YearMonth.of()方法的一些代码示例,展示了YearMonth.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.of()方法的具体详情如下:
包路径:java.time.YearMonth
类名称:YearMonth
方法名:of

YearMonth.of介绍

[英]Obtains an instance of YearMonth from a year and month.
[中]

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public YearMonth convertToEntityAttribute(Integer dbData) {
    return YearMonth.of(dbData / 100, dbData % 100);
  }
}

代码示例来源:origin: wildfly/wildfly

@Override
public YearMonth readObject(ObjectInput input) throws IOException, ClassNotFoundException {
  int year = input.readInt();
  Month month = DefaultExternalizer.MONTH.cast(Month.class).readObject(input);
  return YearMonth.of(year, month);
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
protected void afterEntityManagerFactoryBuilt() {
  doInJPA( this::entityManagerFactory, entityManager -> {
    employee.id = 1L;
    employee.username = "user@acme.com";
    employee.nextVacation = YearMonth.of( 2018, 12 );
    entityManager.persist( employee );
  } );
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void test() {
  doInJPA( this::entityManagerFactory, entityManager -> {
    Employee employee = entityManager.find(Employee.class, 1L);
    assertEquals( YearMonth.of( 2018, 12 ), employee.nextVacation );
  } );
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-jsr310

"Expected array to end");
return YearMonth.of(year, month);

代码示例来源:origin: prestodb/presto

"Expected array to end");
return YearMonth.of(year, month);

代码示例来源:origin: apache/tinkerpop

@Override
protected YearMonth readValue(final ByteBuf buffer, final GraphBinaryReader context) throws SerializationException {
  return YearMonth.of(buffer.readInt(), buffer.readByte());
}

代码示例来源:origin: apache/tinkerpop

@Override
  public <I extends InputShim> YearMonth read(final KryoShim<I, ?> kryo, final I input, final Class<YearMonth> clazz) {
    return YearMonth.of(input.readInt(), input.readInt());
  }
}

代码示例来源:origin: ebean-orm/ebean

protected YearMonth fromLocalDate(LocalDate localDate) {
 return YearMonth.of(localDate.getYear(), localDate.getMonth());
}

代码示例来源:origin: pholser/junit-quickcheck

@Override public YearMonth generate(SourceOfRandomness random, GenerationStatus status) {
    long generated = random.nextLong(
      min.getYear() * 12L + min.getMonthValue() - 1,
      max.getYear() * 12L + max.getMonthValue() - 1);

    return YearMonth.of(
      (int) (generated / 12),
      (int) Math.abs(generated % 12) + 1);
  }
}

代码示例来源:origin: benas/random-beans

@Override
  public YearMonth getRandomValue() {
    Year randomYear = yearRandomizer.getRandomValue();
    Month randomMonth = monthRandomizer.getRandomValue();
    return YearMonth.of(randomYear.getValue(), randomMonth.getValue());
  }
}

代码示例来源:origin: vladmihalcea/high-performance-java-persistence

@Override
  public YearMonth convertToEntityAttribute(Integer dbData) {
    int year = dbData / 100;
    int month = dbData % 100;
    return YearMonth.of(year, month);
  }
}

代码示例来源:origin: apache/tinkerpop

addExtendedEntry(new Short("100"), "Short", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(Year.of(2016), "Year", "The following example is of the `Year` \"2016\".", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(YearMonth.of(2016, 6), "YearMonth", "The following example is a `YearMonth` of \"June 2016\"", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(ZonedDateTime.of(2016, 12, 23, 12, 12, 24, 36, ZoneId.of("GMT+2")), "ZonedDateTime", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(ZoneOffset.ofHoursMinutesSeconds(3, 6, 9), "ZoneOffset", "The following example is a `ZoneOffset` of three hours, six minutes, and nine seconds.", Compatibilities.UNTYPED_GRAPHSON.matchToArray());

代码示例来源:origin: OpenGamma/Strata

public void createFutureFromOptionContractSpec() {
 assertThatThrownBy(() -> OPTION_CONTRACT.createFuture(YearMonth.of(2015, 6), EtdVariant.MONTHLY))
   .isInstanceOf(IllegalStateException.class)
   .hasMessage("Cannot create an EtdFutureSecurity from a contract specification of type 'Option'");
}

代码示例来源:origin: OpenGamma/Strata

public void test_optionIdUnderlying_monthly() {
 SecurityId test = EtdIdUtils.optionId(
   ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34, YearMonth.of(2017, 9));
 assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34-U201709"));
}

代码示例来源:origin: OpenGamma/Strata

public void test_optionIdUnderlying_monthlySameMonth() {
 SecurityId test = EtdIdUtils.optionId(
   ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34, YearMonth.of(2017, 6));
 assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34"));
}

代码示例来源:origin: OpenGamma/Strata

public void test_futureId_flex() {
 SecurityId test = EtdIdUtils.futureId(
   ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofFlexFuture(26, EtdSettlementType.DERIVATIVE));
 assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "F-ECAG-FGBS-20170626D"));
}

代码示例来源:origin: OpenGamma/Strata

static EtdOptionSecurity sut2() {
 return EtdOptionSecurity.builder()
   .info(SecurityInfo.of(SecurityId.of("B", "C"), SecurityPriceInfo.of(Currency.EUR, 10)))
   .contractSpecId(EtdContractSpecId.of("test", "234"))
   .expiry(YearMonth.of(2017, 9))
   .variant(EtdVariant.ofWeekly(2))
   .version(4)
   .putCall(PutCall.CALL)
   .strikePrice(3)
   .underlyingExpiryMonth(YearMonth.of(2017, 12))
   .build();
}

代码示例来源:origin: OpenGamma/Strata

static EtdFutureSecurity sut() {
 return EtdFutureSecurity.builder()
   .info(SecurityInfo.of(SecurityId.of("A", "B"), SecurityPriceInfo.of(Currency.GBP, 100)))
   .contractSpecId(EtdContractSpecId.of("test", "123"))
   .expiry(YearMonth.of(2017, 6))
   .build();
}

代码示例来源:origin: OpenGamma/Strata

static EtdFutureSecurity sut2() {
 return EtdFutureSecurity.builder()
   .info(SecurityInfo.of(SecurityId.of("B", "C"), SecurityPriceInfo.of(Currency.EUR, 10)))
   .contractSpecId(EtdContractSpecId.of("test", "234"))
   .expiry(YearMonth.of(2017, 9))
   .variant(EtdVariant.ofWeekly(2))
   .build();
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com