protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeNumber(value.getYear()); g.writeNumber(value.getMonthValue()); }
protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeNumber(value.getYear()); g.writeNumber(value.getMonthValue()); }
@Override protected ByteBuf writeValue(final YearMonth value, final ByteBufAllocator allocator, final GraphBinaryWriter context) throws SerializationException { return allocator.buffer(2).writeInt(value.getYear()).writeByte(value.getMonthValue()); } }
@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 <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final YearMonth monthDay) { output.writeInt(monthDay.getYear()); output.writeInt(monthDay.getMonthValue()); }
@Override public ByteBuf writeValue(final YearMonth value, final ByteBufAllocator allocator, final GraphBinaryWriter context) throws SerializationException { return allocator.buffer(2).writeInt(value.getYear()).writeByte(value.getMonthValue()); } }
@Override public void serialize(YearMonth value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { Map<String, Integer> map = new LinkedHashMap<>(); map.put("year", value.getYear()); map.put("month", value.getMonthValue()); provider.defaultSerializeValue( map, jgen ); }
DateTimeFormatter formatter = new DateTimeFormatterBuilder() .appendPattern("MMMM yyyy") .toFormatter(Locale.US); TemporalAccessor ta = formatter.parse("October 2015"); YearMonth ym = YearMonth.from(ta); LocalDateTime dt = LocalDateTime.of(ym.getYear(), ym.getMonthValue(), 1, 0, 0, 0); Instant instant = Instant.from(dt.atZone(ZoneId.systemDefault())); Date d = Date.from(instant);
@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 String getReadOnlyFormattedText(WicketBuildContext ctx, IModel<? extends SInstance> model) { if ((model != null) && (model.getObject() != null)) { SInstance instance = model.getObject(); if (instance.getValue() instanceof YearMonth) { YearMonth ym = (YearMonth) instance.getValue(); return String.format("%02d/%04d", ym.getMonthValue(), ym.getYear()); } } return StringUtils.EMPTY; } }
@Override public String getReadOnlyFormattedText(WicketBuildContext ctx, IModel<? extends SInstance> model) { if ((model != null) && (model.getObject() != null)) { SInstance instancia = model.getObject(); if (instancia.getValue() instanceof YearMonth) { YearMonth ym = (YearMonth) instancia.getValue(); return String.format("%02d/%04d", ym.getMonthValue(), ym.getYear()); } } return StringUtils.EMPTY; } }
@Override public LocalDate convert(YearMonth in, Context context) throws Exception { if (in == null) return null; return LocalDate.fromYearMonthDay(in.getYear(), in.getMonthValue(), 1); } });
@Override public void write(ByteWriter writer, YearMonth yearMonth) { Preconditions.checkArgument(yearMonth != null, "null yearMonth"); Preconditions.checkArgument(writer != null); LongEncoder.write(writer, yearMonth.getYear()); LongEncoder.write(writer, yearMonth.getMonthValue()); }
public Integer getMes() { if (isEmptyOfData()) { return null; } return getValue().getMonthValue(); }
public Integer getMes() { if (isEmptyOfData()) { return null; } return getValue().getMonthValue(); }
@Override public void write(ByteWriter writer, YearMonth yearMonth) { Preconditions.checkArgument(yearMonth != null, "null yearMonth"); Preconditions.checkArgument(writer != null); LongEncoder.write(writer, yearMonth.getYear()); LongEncoder.write(writer, yearMonth.getMonthValue()); }
protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeNumber(value.getYear()); g.writeNumber(value.getMonthValue()); }
protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeNumber(value.getYear()); g.writeNumber(value.getMonthValue()); }
public void write (Kryo kryo, Output out, YearMonth obj) { out.writeInt(obj.getYear(), true); out.writeByte(obj.getMonthValue()); }
@Override public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final YearMonth monthDay) { output.writeInt(monthDay.getYear()); output.writeInt(monthDay.getMonthValue()); }