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

fr.ird.observe.entities.referentiel.I18nReferenceEntities Maven / Gradle / Ivy

The newest version!
package fr.ird.observe.entities.referentiel;

/*
 * #%L
 * ObServe Toolkit :: Common Db
 * %%
 * Copyright (C) 2008 - 2017 IRD, Ultreia.io
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public
 * License along with this program.  If not, see
 * .
 * #L%
 */

/**
 * Created on 29/08/15.
 *
 * @author Tony Chemit - [email protected]
 */
public class I18nReferenceEntities {

    public static String getPropertyName(int referenceLocaleOrdinal) {
        return "label" + (referenceLocaleOrdinal + 1);
    }

    public static  String getLabel(int referenceLocaleOrdinal, E i18nEntity) {

        String result = null;

        switch (referenceLocaleOrdinal + 1) {
            case 1:
                result = i18nEntity.getLabel1();
                break;
            case 2:
                result = i18nEntity.getLabel2();
                break;
            case 3:
                result = i18nEntity.getLabel3();
                break;
            case 4:
                result = i18nEntity.getLabel4();
                break;
            case 5:
                result = i18nEntity.getLabel5();
                break;
            case 6:
                result = i18nEntity.getLabel6();
                break;
            case 7:
                result = i18nEntity.getLabel7();
                break;
            case 8:
                result = i18nEntity.getLabel8();
                break;
        }

        return result;

    }

    public static  void setLabel(int referenceLocaleOrdinal, E i18nEntity, String label) {

        switch (referenceLocaleOrdinal + 1) {
            case 1:
                i18nEntity.setLabel1(label);
                break;
            case 2:
                i18nEntity.setLabel2(label);
                break;
            case 3:
                i18nEntity.setLabel3(label);
                break;
            case 4:
                i18nEntity.setLabel4(label);
                break;
            case 5:
                i18nEntity.setLabel5(label);
                break;
            case 6:
                i18nEntity.setLabel6(label);
                break;
            case 7:
                i18nEntity.setLabel7(label);
                break;
            case 8:
                i18nEntity.setLabel8(label);
                break;
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy