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

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

Go to download

Java tools for JSContact building, validation, serialization/deserialization and conversion from vCard 4.0 (RFC6350) and its transliterations, namely xCard (RFC6351) and jCard (RFC7095).

There is a newer version: 1.0.1
Show newest version
/*
 *    Copyright (C) 2020  Consiglio Nazionale delle Ricerche
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Affero General Public License as
 *     published by the Free Software Foundation, either version 3 of the
 *     License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Affero General Public License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with this program.  If not, see .
 */
package it.cnr.iit.jscontact.tools.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;

/**
 * Class mapping the pronounce system values as defined in section 1.5.5 of [draft-ietf-calext-jscontact].
 *
 * @see draft-ietf-calext-jscontact
 * @author Mario Loffredo
 */
@Getter
@Setter
@ToString(callSuper = true)
@NoArgsConstructor
@SuperBuilder
public class PhoneticSystem extends ExtensibleEnumType implements Serializable {

    /**
     * Tests if the pronounce system is "ipa".
     *
     * @return true if the pronounce system is "ipa", false otherwise
     */
    @JsonIgnore
    public boolean isIpa() { return isRfc(PhoneticSystemEnum.IPA); }

    /**
     * Tests if the pronounce system is "piny".
     *
     * @return true if the pronounce system is "piny", false otherwise
     */
    @JsonIgnore
    public boolean isPiny() { return isRfc(PhoneticSystemEnum.PINY); }

    /**
     * Tests if the pronounce system is "jyut".
     *
     * @return true if the pronounce system is "jyut", false otherwise
     */
    @JsonIgnore
    public boolean isJyut() { return isRfc(PhoneticSystemEnum.JYUT); }

    /**
     * Returns a pronounce system whose enum value is pre-defined.
     *
     * @param rfcValue the pre-defined pronounce system
     * @return a pre-defined pronounce system
     */
    public static PhoneticSystem rfc(PhoneticSystemEnum rfcValue) { return PhoneticSystem.builder().rfcValue(rfcValue).build();}

    /**
     * Returns a "ipa" pronounce system.
     *
     * @return a "ipa" pronounce system
     */
    public static PhoneticSystem ipa() { return rfc(PhoneticSystemEnum.IPA);}

    /**
     * Returns a "piny" pronounce system.
     *
     * @return a "piny" pronounce system
     */
    public static PhoneticSystem piny() { return rfc(PhoneticSystemEnum.PINY);}

    /**
     * Returns a "jyut" pronounce system.
     *
     * @return a "jyut" pronounce system
     */
    public static PhoneticSystem jyut() { return rfc(PhoneticSystemEnum.JYUT);}
    /**
     * Returns a custom relation type.
     *
     * @param extValue the custom relation type
     * @return a custom relation type
     */
    public static PhoneticSystem ext(String extValue) { return PhoneticSystem.builder().extValue(V_Extension.toV_Extension(extValue)).build(); }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy