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

x33g5p2x  于2022-02-05 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(128)

本文整理了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

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

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

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

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

  1. @Override
  2. public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
  3. {
  4. if (useTimestamp(provider)) {
  5. g.writeStartArray();
  6. _serializeAsArrayContents(value, g, provider);
  7. g.writeEndArray();
  8. return;
  9. }
  10. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  11. }

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

  1. @Override
  2. public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
  3. {
  4. if (useTimestamp(provider)) {
  5. g.writeStartArray();
  6. _serializeAsArrayContents(value, g, provider);
  7. g.writeEndArray();
  8. return;
  9. }
  10. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  11. }

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

  1. @Override
  2. public void serializeWithType(YearMonth value, JsonGenerator g,
  3. SerializerProvider provider, TypeSerializer typeSer) throws IOException
  4. {
  5. WritableTypeId typeIdDef = typeSer.writeTypePrefix(g,
  6. typeSer.typeId(value, serializationShape(provider)));
  7. // need to write out to avoid double-writing array markers
  8. if (typeIdDef.valueShape == JsonToken.START_ARRAY) {
  9. _serializeAsArrayContents(value, g, provider);
  10. } else {
  11. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  12. }
  13. typeSer.writeTypeSuffix(g, typeIdDef);
  14. }

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

  1. @Override
  2. public void serializeWithType(YearMonth value, JsonGenerator g,
  3. SerializerProvider provider, TypeSerializer typeSer) throws IOException
  4. {
  5. WritableTypeId typeIdDef = typeSer.writeTypePrefix(g,
  6. typeSer.typeId(value, serializationShape(provider)));
  7. // need to write out to avoid double-writing array markers
  8. if (typeIdDef.valueShape == JsonToken.START_ARRAY) {
  9. _serializeAsArrayContents(value, g, provider);
  10. } else {
  11. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  12. }
  13. typeSer.writeTypeSuffix(g, typeIdDef);
  14. }

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

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

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

  1. @Override
  2. public String convertToDatabaseColumn(YearMonth yearmonth)
  3. {
  4. if (yearmonth == null)
  5. return null;
  6. return yearmonth.toString();
  7. }

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

  1. @Override
  2. public String toNonNullValue(YearMonth value) {
  3. return value.toString();
  4. }
  5. }

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

  1. @Override
  2. public String toNonNullValue(YearMonth value) {
  3. return value.toString();
  4. }
  5. }

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

  1. @Override
  2. public String marshal(final YearMonth yearMonth) {
  3. return yearMonth.toString();
  4. }
  5. }

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

  1. @Override
  2. public String marshal(final YearMonth yearMonth) {
  3. return yearMonth.toString();
  4. }
  5. }

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

  1. @Override
  2. public String toParseableString(YearMonth yearMonth) {
  3. return yearMonth.toString();
  4. }

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

  1. @Override
  2. public String toParseableString(YearMonth yearMonth) {
  3. return yearMonth.toString();
  4. }

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

  1. /** 指定された年月(java.time.YearMonth)をISO-8601拡張形式の文字列に変換します。
  2. *
  3. * @param value 年月(java.time.YearMont)
  4. * @return 変換された文字列
  5. */
  6. @Override
  7. public String toString(YearMonth value) {
  8. if(value == null) {
  9. return null;
  10. }
  11. return value.toString(); // yyyy-MM
  12. }
  13. }

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

  1. @Override
  2. public void write(JsonWriter out, YearMonth yearMonth) throws IOException {
  3. if (yearMonth == null) {
  4. out.nullValue();
  5. return;
  6. }
  7. out.value(yearMonth.toString());
  8. }

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

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

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

  1. @Override
  2. public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
  3. {
  4. if (useTimestamp(provider)) {
  5. g.writeStartArray();
  6. _serializeAsArrayContents(value, g, provider);
  7. g.writeEndArray();
  8. return;
  9. }
  10. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  11. }

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

  1. @Override
  2. public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
  3. {
  4. if (useTimestamp(provider)) {
  5. g.writeStartArray();
  6. _serializeAsArrayContents(value, g, provider);
  7. g.writeEndArray();
  8. return;
  9. }
  10. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  11. }

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

  1. @Override
  2. public void serialize(YearMonth value, JsonGenerator g, SerializerProvider provider) throws IOException
  3. {
  4. if (useTimestamp(provider)) {
  5. g.writeStartArray();
  6. _serializeAsArrayContents(value, g, provider);
  7. g.writeEndArray();
  8. return;
  9. }
  10. g.writeString((_formatter == null) ? value.toString() : value.format(_formatter));
  11. }

相关文章