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

commons.box.app.MetaLabel Maven / Gradle / Ivy

The newest version!
package commons.box.app;

import java.util.Map;

/**
 * 定义了 标签集合 通过 prop 名称获取所包含的标签
 */
public interface MetaLabel extends MetaLabelValue, DataObject {
    public Map propLabels();

    /**
     * 属性对应的标签
     *
     * @param pn
     * @return
     */
    default String propLabel(String pn) {
        if (pn == null) return null;
        Map pls = this.propLabels();
        if (pls == null) return null;
        MetaLabelValue mp = pls.get(pn);
        if (mp == null) return null;
        return mp.label();
    }


    /**
     * 属性对应的标签 带语区
     *
     * @param locale
     * @param pn
     * @return
     */
    default String propLabel(String locale, String pn) {
        if (pn == null) return null;
        Map pls = this.propLabels();
        if (pls == null) return null;
        MetaLabelValue mp = pls.get(pn);
        if (mp == null) return null;
        return mp.label(locale);
    }

    /**
     * 属性的值对应的标签
     *
     * @param pn
     * @param value
     * @return
     */
    default String propValueLabel(String pn, String value) {
        if (pn == null) return null;
        Map pls = this.propLabels();
        if (pls == null) return null;
        MetaLabelValue mp = pls.get(pn);
        if (mp == null) return null;
        return mp.valueLabel(value);
    }

    /**
     * 属性的值对应的标签 带语区
     *
     * @param locale
     * @param pn
     * @param value
     * @return
     */
    default String propValueLabel(String locale, String pn, String value) {
        if (pn == null) return null;
        Map pls = this.propLabels();
        if (pls == null) return null;
        MetaLabelValue mp = pls.get(pn);
        if (mp == null) return null;
        return mp.valueLabel(locale, value);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy