spring security LocalDateTimeAdapter 源码

  • 2022-08-13
  • 浏览 (494)

spring security LocalDateTimeAdapter 代码

文件路径:/buildSrc/src/main/java/org/springframework/gradle/github/milestones/LocalDateTimeAdapter.java

package org.springframework.gradle.github.milestones;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * @author Steve Riesenberg
 */
class LocalDateTimeAdapter extends TypeAdapter<LocalDateTime> {
	@Override
	public void write(JsonWriter jsonWriter, LocalDateTime localDateTime) throws IOException {
		jsonWriter.value(localDateTime.atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_ZONED_DATE_TIME));
	}

	@Override
	public LocalDateTime read(JsonReader jsonReader) throws IOException {
		return LocalDateTime.parse(jsonReader.nextString(), DateTimeFormatter.ISO_ZONED_DATE_TIME);
	}
}

相关信息

spring security 源码目录

相关文章

spring security GitHubMilestoneApi 源码

spring security GitHubMilestoneHasNoOpenIssuesTask 源码

spring security GitHubMilestoneNextReleaseTask 源码

spring security GitHubMilestoneNextVersionDueTodayTask 源码

spring security GitHubMilestonePlugin 源码

spring security LocalDateAdapter 源码

spring security Milestone 源码

spring security NextVersionYml 源码

spring security ScheduleNextReleaseTask 源码

spring security SpringReleaseTrain 源码

0  赞