org.apache.james.imap.api.display.Locales Maven / Gradle / Ivy
/****************************************************************
* Licensed to the Apache Software Foundation (ASF) under one *
* or more contributor license agreements. See the NOTICE file *
* distributed with this work for additional information *
* regarding copyright ownership. The ASF licenses this file *
* to you under the Apache License, Version 2.0 (the *
* "License"); you may not use this file except in compliance *
* with the License. You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, *
* software distributed under the License is distributed on an *
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
****************************************************************/
package org.apache.james.imap.api.display;
import java.util.List;
import java.util.Locale;
/**
* Immutable bean describing localisation preferences.
* Two separate sources of information about localisation are available:
*
* - A client may ask for a locale (see {@link #getClientPreference()})
* - Localisation preferences may be available from user data(see @link {@link #getUserPreferences()})
*
*/
public class Locales {
private final List userPreferences;
private final Locale clientPreference;
public Locales(final List userPreferences, final Locale clientPreference) {
super();
this.userPreferences = userPreferences;
this.clientPreference = clientPreference;
}
/**
* Gets the locale preferred by the client.
* @return when set, the locale currently preferred by the client
* or null when no preference has been set by the client
* @see #getUserPreferences()
*/
public Locale getClientPreference() {
return clientPreference;
}
/**
* Gets the list of locales preferred by the user.
* @return preferred first not null, possibly empty
* @see #getUserPreferences()
*/
public List getUserPreferences() {
return userPreferences;
}
}