Skip to content

Remove reliance on java.util.Date in favor of the newer Date-Time APIs #430

@grimsa

Description

@grimsa

The classes in the current Segment Java SDK accept the old java.util.Date in method signatures, for example:

var message = TrackMessage.builder(event.documentName())
        .timestamp(java.util.Date.from(event.time()))      // <-- here we have to convert Instant to Date
        .userId(event.user().id())
        .properties(properties);

Java 8 introduced the new The Date-Time APIs (e.g. java.time.Instant), which are preferred over the old java.util.Date/Calendar for their immutability, thread safety, and expressiveness.

It seems it should be possible to add overloaded method versions to support the new Date-Time APIs without changing or removing the existing methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions