@Override public YearMonth convertToEntityAttribute(Integer dbData) { return YearMonth.of(dbData / 100, dbData % 100); } }
@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); }
@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 ); } ); }
@Test public void test() { doInJPA( this::entityManagerFactory, entityManager -> { Employee employee = entityManager.find(Employee.class, 1L); assertEquals( YearMonth.of( 2018, 12 ), employee.nextVacation ); } ); }
"Expected array to end"); return YearMonth.of(year, month);
"Expected array to end"); return YearMonth.of(year, month);
@Override protected YearMonth readValue(final ByteBuf buffer, final GraphBinaryReader context) throws SerializationException { return YearMonth.of(buffer.readInt(), buffer.readByte()); }
@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()); } }
protected YearMonth fromLocalDate(LocalDate localDate) { return YearMonth.of(localDate.getYear(), localDate.getMonth()); }
@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); } }
@Override public YearMonth getRandomValue() { Year randomYear = yearRandomizer.getRandomValue(); Month randomMonth = monthRandomizer.getRandomValue(); return YearMonth.of(randomYear.getValue(), randomMonth.getValue()); } }
@Override public YearMonth convertToEntityAttribute(Integer dbData) { int year = dbData / 100; int month = dbData % 100; return YearMonth.of(year, month); } }
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());
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'"); }
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")); }
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(); }
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(); }
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(); }