class DurationConverter implements AttributeConverter<Duration, String> {

  @Override
  public Duration convertToEntityAttribute(String durationString) {
    if (durationString != null) {
      return Duration.parse(durationString);
    } else {
      return null;
    }
  }

}