com.regnosys.rosetta.translate.basic.TimeParseHandler Maven / Gradle / Ivy
package com.regnosys.rosetta.translate.basic;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
public class TimeParseHandler extends BasicParseHandler {
private DateTimeFormatter pattern;
public TimeParseHandler(boolean allowsMultiple, boolean isCondition, boolean removeHtml) {
super(allowsMultiple, isCondition, removeHtml);
this.pattern = DateTimeFormatter.ISO_LOCAL_TIME;
}
public TimeParseHandler(boolean allowsMultiple, boolean isCondition, boolean removeHtml, String pattern) {
super(allowsMultiple, isCondition, removeHtml);
this.pattern = DateTimeFormatter.ofPattern(pattern);
}
@Override
public String toString() {
return "LocalTime";
}
@Override
protected LocalTime convert(String value) {
return LocalTime.parse(value, pattern);
}
}