gpt4 book ai didi

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

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

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

YearMonth.getMonthValue介绍

[英]Gets the month-of-year field from 1 to 12.

This method returns the month as an int from 1 to 12. Application code is frequently clearer if the enum Monthis used by calling #getMonth().
[中]获取从1到12的月份字段。
此方法将月份返回为1到12之间的整数。如果通过调用#getMonth()来使用enum Monthis,则应用程序代码通常更清晰。

代码示例

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

protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getYear());
  g.writeNumber(value.getMonthValue());
}

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

protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getYear());
  g.writeNumber(value.getMonthValue());
}

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

@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());
  }
}

代码示例来源: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: apache/tinkerpop

@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());
}

代码示例来源:origin: org.apache.tinkerpop/gremlin-driver

@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());
  }
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-json

@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
  );
}

代码示例来源:origin: stackoverflow.com

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);

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

@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: org.opensingular/singular-form-wicket

@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;
  }
}

代码示例来源:origin: org.opensingular/form-wicket

@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;
  }
}

代码示例来源:origin: arnaudroger/SimpleFlatMapper

@Override
  public LocalDate convert(YearMonth in, Context context) throws Exception {
    if (in == null) return null;
    return LocalDate.fromYearMonthDay(in.getYear(), in.getMonthValue(), 1);
  }
});

代码示例来源:origin: io.permazen/permazen-coreapi

@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());
}

代码示例来源:origin: org.opensingular/singular-form-core

public Integer getMes() {
  if (isEmptyOfData()) {
    return null;
  }
  return getValue().getMonthValue();
}

代码示例来源:origin: org.opensingular/form-core

public Integer getMes() {
  if (isEmptyOfData()) {
    return null;
  }
  return getValue().getMonthValue();
}

代码示例来源:origin: org.jsimpledb/jsimpledb-coreapi

@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());
}

代码示例来源:origin: io.prestosql/presto-jdbc

protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getYear());
  g.writeNumber(value.getMonthValue());
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

protected void _serializeAsArrayContents(YearMonth value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getYear());
  g.writeNumber(value.getMonthValue());
}

代码示例来源:origin: com.esotericsoftware/kryo

public void write (Kryo kryo, Output out, YearMonth obj) {
  out.writeInt(obj.getYear(), true);
  out.writeByte(obj.getMonthValue());
}

代码示例来源:origin: org.apache.tinkerpop/gremlin-core

@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());
}

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