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

ca.ibodrov.mica.api.model.EntityId Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.UUID;

import static com.fasterxml.jackson.annotation.JsonCreator.Mode.DELEGATING;
import static java.util.Objects.requireNonNull;

public record EntityId(UUID id) {

    @JsonCreator(mode = DELEGATING)
    public EntityId {
        requireNonNull(id);
    }

    @Override
    @JsonValue
    public UUID id() {
        return id;
    }

    public String toExternalForm() {
        return id.toString();
    }

    public static EntityId fromString(String s) {
        return new EntityId(UUID.fromString(s));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy