All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.smartcontract.valuation.marketdata.data.LocalDateTimeAdapter Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package net.finmath.smartcontract.valuation.marketdata.data;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LocalDateTimeAdapter extends XmlAdapter {

	@Override
	public String marshal(LocalDateTime v) {
		return v.format(DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"));
	}

	@Override
	public LocalDateTime unmarshal(String str) throws ParseException {
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss");
		return LocalDateTime.parse(str, formatter);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy