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

ca.ibodrov.mica.server.api.ApiUtils Maven / Gradle / Ivy

There is a newer version: 0.0.25
Show newest version
package ca.ibodrov.mica.server.api;

import com.walmartlabs.concord.common.DateTimeUtils;

import java.time.Instant;
import java.time.OffsetDateTime;
import java.util.Optional;

public final class ApiUtils {

    public static String nonBlank(String s) {
        if (s == null || s.isBlank()) {
            return null;
        }
        return s;
    }

    public static Optional parseIsoAsInstant(String s) {
        return Optional.ofNullable(nonBlank(s))
                .map(DateTimeUtils::fromIsoString)
                .map(OffsetDateTime::toInstant);
    }

    private ApiUtils() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy