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

it.cnr.iit.jscontact.tools.dto.Nickname Maven / Gradle / Ivy

package it.cnr.iit.jscontact.tools.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import it.cnr.iit.jscontact.tools.constraints.BooleanMapConstraint;
import it.cnr.iit.jscontact.tools.dto.deserializers.ContextsDeserializer;
import it.cnr.iit.jscontact.tools.dto.interfaces.HasContexts;
import it.cnr.iit.jscontact.tools.dto.interfaces.IdMapValue;
import it.cnr.iit.jscontact.tools.dto.interfaces.IsIANAType;
import it.cnr.iit.jscontact.tools.dto.serializers.ContextsSerializer;
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Map;

/**
 * Class mapping the Nickname type as defined in section 2.2.1 of [draft-ietf-calext-jscontact].
 *
 * @see draft-ietf-calext-jscontact
 * @author Mario Loffredo
 */
@JsonPropertyOrder({"@type","name","contexts","pref","label"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@SuperBuilder
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Nickname extends AbstractJSContactType implements IdMapValue, Serializable, HasContexts, IsIANAType {

    @Pattern(regexp = "Nickname", message="invalid @type value in Nickname")
    @JsonProperty("@type")
    @Builder.Default
    String _type = "Nickname";

    @NotNull(message = "name is missing in Nickname")
    @NonNull
    String name;

    @JsonSerialize(using = ContextsSerializer.class)
    @JsonDeserialize(using = ContextsDeserializer.class)
    @BooleanMapConstraint(message = "invalid Map contexts in Nickname - Only Boolean.TRUE allowed")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    Map contexts;

    @Min(value=1, message = "invalid pref in Nickname - value must be greater or equal than 1")
    @Max(value=100, message = "invalid pref in Nickname - value must be less or equal than 100")
    Integer pref;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy