@Override public String print(YearMonth object, Locale locale) { return object.toString(); }
@Override public String print(YearMonth object, Locale locale) { return object.toString(); }
@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)); }
@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)); }
@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); }
@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); }
@Override public void setNonNullParameter(PreparedStatement ps, int i, YearMonth yearMonth, JdbcType jt) throws SQLException { ps.setString(i, yearMonth.toString()); }
@Override public String convertToDatabaseColumn(YearMonth yearmonth) { if (yearmonth == null) return null; return yearmonth.toString(); }
@Override public String toNonNullValue(YearMonth value) { return value.toString(); } }
@Override public String toNonNullValue(YearMonth value) { return value.toString(); } }
@Override public String marshal(final YearMonth yearMonth) { return yearMonth.toString(); } }
@Override public String marshal(final YearMonth yearMonth) { return yearMonth.toString(); } }
@Override public String toParseableString(YearMonth yearMonth) { return yearMonth.toString(); }
@Override public String toParseableString(YearMonth yearMonth) { return yearMonth.toString(); }
/** 指定された年月(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 } }
@Override public void write(JsonWriter out, YearMonth yearMonth) throws IOException { if (yearMonth == null) { out.nullValue(); return; } out.value(yearMonth.toString()); }
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.
@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)); }
@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)); }
@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)); }