gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-18 01:16:40 25 4
gpt4 key购买 nike

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

YearMonth.toString介绍

[英]Outputs this year-month as a String, such as 2007-12.

The output will be in the format yyyy-MM:
[中]以字符串形式输出今年的月份,例如2007-12。
输出格式为yyyy-MM:

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public String print(YearMonth object, Locale locale) {
  return object.toString();
}

代码示例来源:origin: org.springframework/spring-context

@Override
public String print(YearMonth object, Locale locale) {
  return object.toString();
}

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

@Override
public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    g.writeStartArray();
    _serializeAsArrayContents(value, g, provider);
    g.writeEndArray();
    return;
  }
  g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
}

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

@Override
public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    g.writeStartArray();
    _serializeAsArrayContents(value, g, provider);
    g.writeEndArray();
    return;
  }
  g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
}

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

@Override
public void serializeWithType(YearMonth value, JsonGenerator g,
    SerializerProvider provider, TypeSerializer typeSer) throws IOException
{
  WritableTypeId typeIdDef = typeSer.writeTypePrefix(g,
      typeSer.typeId(value, serializationShape(provider)));
  // need to write out to avoid double-writing array markers
  if (typeIdDef.valueShape == JsonToken.START_ARRAY) {
    _serializeAsArrayContents(value, g, provider);
  } else {
    g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  }
  typeSer.writeTypeSuffix(g, typeIdDef);
}

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

@Override
public void serializeWithType(YearMonth value, JsonGenerator g,
    SerializerProvider provider, TypeSerializer typeSer) throws IOException
{
  WritableTypeId typeIdDef = typeSer.writeTypePrefix(g,
      typeSer.typeId(value, serializationShape(provider)));
  // need to write out to avoid double-writing array markers
  if (typeIdDef.valueShape == JsonToken.START_ARRAY) {
    _serializeAsArrayContents(value, g, provider);
  } else {
    g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  }
  typeSer.writeTypeSuffix(g, typeIdDef);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public void setNonNullParameter(PreparedStatement ps, int i, YearMonth yearMonth, JdbcType jt) throws SQLException {
 ps.setString(i, yearMonth.toString());
}

代码示例来源:origin: de.juplo/jpa-converters

@Override
public String convertToDatabaseColumn(YearMonth yearmonth)
{
 if (yearmonth == null)
  return null;
 return yearmonth.toString();
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
  public String toNonNullValue(YearMonth value) {
    return value.toString();
  }
}

代码示例来源:origin: org.jadira.usertype/usertype.extended

@Override
  public String toNonNullValue(YearMonth value) {
    return value.toString();
  }
}

代码示例来源:origin: RoboZonky/robozonky

@Override
  public String marshal(final YearMonth yearMonth) {
    return yearMonth.toString();
  }
}

代码示例来源:origin: com.github.robozonky/robozonky-api

@Override
  public String marshal(final YearMonth yearMonth) {
    return yearMonth.toString();
  }
}

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

@Override
public String toParseableString(YearMonth yearMonth) {
  return yearMonth.toString();
}

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

@Override
public String toParseableString(YearMonth yearMonth) {
  return yearMonth.toString();
}

代码示例来源:origin: net.osdn.util.json.jackson/jackson-datetime-module

/** 指定された年月(java.time.YearMonth)をISO-8601拡張形式の文字列に変換します。
   * 
   * @param value 年月(java.time.YearMont)
   * @return 変換された文字列
   */
  @Override
  public String toString(YearMonth value) {
    if(value == null) {
      return null;
    }
    return value.toString(); // yyyy-MM
  }
}

代码示例来源:origin: net.dongliu/gson-java8-datatype

@Override
public void write(JsonWriter out, YearMonth yearMonth) throws IOException {
  if (yearMonth == null) {
    out.nullValue();
    return;
  }
  out.value(yearMonth.toString());
}

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

String input = "2014-02";
YearMonth yearMonth = YearMonth.parse( input ); // Construct by parsing string.
int year = yearMonth.getYear(); 
int month = yearMonth.getMonthOfYear();
String output = yearMonth.toString(); // Joda-Time uses ISO 8601 formats by default for generating strings.
YearMonth yearMonth2 = new YearMonth( year , month ); // Construct by passing numbers for year and month.

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

@Override
public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    g.writeStartArray();
    _serializeAsArrayContents(value, g, provider);
    g.writeEndArray();
    return;
  }
  g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
}

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

@Override
public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    g.writeStartArray();
    _serializeAsArrayContents(value, g, provider);
    g.writeEndArray();
    return;
  }
  g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
}

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

@Override
public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
{
  if (useTimestamp(provider)) {
    g.writeStartArray();
    _serializeAsArrayContents(value, g, provider);
    g.writeEndArray();
    return;
  }
  g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
}

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