github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/RFC3339DateFormat.mustache (about)

     1  {{>licenseInfo}}
     2  package {{invokerPackage}};
     3  
     4  import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
     5  import com.fasterxml.jackson.databind.util.ISO8601Utils;
     6  
     7  import java.text.FieldPosition;
     8  import java.util.Date;
     9  
    10  
    11  public class RFC3339DateFormat extends ISO8601DateFormat {
    12  
    13    // Same as ISO8601DateFormat but serializing milliseconds.
    14    @Override
    15    public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
    16      String value = ISO8601Utils.format(date, true);
    17      toAppendTo.append(value);
    18      return toAppendTo;
    19    }
    20  
    21  }