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

com.force.i18n.grammar.LanguagePosition Maven / Gradle / Ivy

There is a newer version: 1.2.30
Show newest version
/* 
 * Copyright (c) 2017, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license. 
 * For full license text, see LICENSE.txt file in the repo root  or https://opensource.org/licenses/BSD-3-Clause
 */

package com.force.i18n.grammar;

/**
 * Represents the different positions of modifiers with respect to the noun.
 * This allows better tracking of which noun the adjective is modifying
 *
 * @author stamm
 */
public enum LanguagePosition {
    PRE("b", "Pre"),   // b = before
    POST("a", "Post")  // a = after
    ;
	
	public static final char JSON_ATTR_NAME = 'l';  // l for location, since p is posessive 

    private final String dbValue;
    private final String apiValue;
    private LanguagePosition(String dbValue, String apiValue) {
        this.dbValue = dbValue;
        this.apiValue = apiValue;
    }
    public String getDbValue() { return this.dbValue; }
    public String getApiValue() { return this.apiValue; }
    public boolean isDefault() { return false; }
    public static LanguagePosition fromDbValue(String dbValue) {
        for (LanguagePosition e : values()) {
            if (e.getDbValue().equals(dbValue)) return e;
        }
        return null;
    }

    public static LanguagePosition fromLabelValue(String labelValue) {
        if (labelValue == null) return null;
        for (LanguagePosition e : values()) {
            if (e.getDbValue().equals(labelValue) || e.getApiValue().equals(labelValue)) return e;
        }
        return null;
    }

    public static LanguagePosition fromApiValue(String apiValue) {
        for (LanguagePosition e : values()) {
            if (e.getApiValue().equals(apiValue)) return e;
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy