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

org.glassfish.jersey.oauth1.signature.internal.LocalizationMessages Maven / Gradle / Ivy

There is a newer version: 4.0.0-M1
Show newest version

package org.glassfish.jersey.oauth1.signature.internal;

import java.util.Locale;
import java.util.ResourceBundle;
import org.glassfish.jersey.internal.l10n.Localizable;
import org.glassfish.jersey.internal.l10n.LocalizableMessageFactory;
import org.glassfish.jersey.internal.l10n.LocalizableMessageFactory.ResourceBundleSupplier;
import org.glassfish.jersey.internal.l10n.Localizer;


/**
 * Defines string formatting method for each constant in the resource file
 * 
 */
public final class LocalizationMessages {

    private final static String BUNDLE_NAME = "org.glassfish.jersey.oauth1.signature.internal.localization";
    private final static LocalizableMessageFactory MESSAGE_FACTORY = new LocalizableMessageFactory(BUNDLE_NAME, new LocalizationMessages.BundleSupplier());
    private final static Localizer LOCALIZER = new Localizer();

    public static Localizable localizableERROR_CANNOT_OBTAIN_PUBLIC_KEY() {
        return MESSAGE_FACTORY.getMessage("error.cannot.obtain.public.key");
    }

    /**
     * Couldn''t obtain public key from consumer secret.
     * 
     */
    public static String ERROR_CANNOT_OBTAIN_PUBLIC_KEY() {
        return LOCALIZER.localize(localizableERROR_CANNOT_OBTAIN_PUBLIC_KEY());
    }

    public static Localizable localizableERROR_INVALID_CONSUMER_SECRET(Object arg0) {
        return MESSAGE_FACTORY.getMessage("error.invalid.consumer.secret", arg0);
    }

    /**
     * Invalid consumer secret: {0}
     * 
     */
    public static String ERROR_INVALID_CONSUMER_SECRET(Object arg0) {
        return LOCALIZER.localize(localizableERROR_INVALID_CONSUMER_SECRET(arg0));
    }

    public static Localizable localizableERROR_BASE_64_INVALID_CHARACTER() {
        return MESSAGE_FACTORY.getMessage("error.base64.invalid.character");
    }

    /**
     * Invalid character in Base64 string.
     * 
     */
    public static String ERROR_BASE_64_INVALID_CHARACTER() {
        return LOCALIZER.localize(localizableERROR_BASE_64_INVALID_CHARACTER());
    }

    public static Localizable localizableERROR_BASE_64_LENGTH() {
        return MESSAGE_FACTORY.getMessage("error.base64.length");
    }

    /**
     * Base64 string length is not multiple of 4.
     * 
     */
    public static String ERROR_BASE_64_LENGTH() {
        return LOCALIZER.localize(localizableERROR_BASE_64_LENGTH());
    }

    private static class BundleSupplier
        implements ResourceBundleSupplier
    {


        public ResourceBundle getResourceBundle(Locale locale) {
            return ResourceBundle.getBundle(BUNDLE_NAME, locale);
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy