annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultPreferredLocale.java @ 93:e27cf9c84eb8

Unified imports. artifacts/trunk@849 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 28 Mar 2010 15:57:40 +0000
parents 68285f7bc476
children 933bbc9fc11f
rev   line source
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.artifactdatabase;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.artifacts.PreferredLocale;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import java.util.Locale;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 /**
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
8 * Models a pair of Locale and quality (0.0-1.0) to be used to
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
9 * find best matching locale between server offerings and clients requests.
90
68285f7bc476 More javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 89
diff changeset
10 *
77
48d1a9a082c2 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 48
diff changeset
11 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 */
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 public class DefaultPreferredLocale
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 implements PreferredLocale
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 {
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
16 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
17 * The locale of this tuple pair.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
18 */
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 protected Locale locale;
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
20 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
21 * The quality of this tuple pair between 0.0 and 1.0.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
22 */
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 protected float quality;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
25 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
26 * Default constructor
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
27 */
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 public DefaultPreferredLocale() {
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 }
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
31 /**
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
32 * Constructor to build a pair of given a locale speficied by
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
33 * string 'lang' and an given 'quality'.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
34 * @param lang The name of the locale.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
35 * @param quality The quality of the locale.
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
36 */
48
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 public DefaultPreferredLocale(String lang, float quality) {
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 locale = new Locale(lang);
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 this.quality = quality;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 }
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 public Locale getLocale() {
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 return locale;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 }
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 public float getQuality() {
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 return quality;
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 }
41c225c8bd41 Add i18n support via "Accept-Language" HTTP headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
89
d348fe1fd822 More javadoc (fixes small glitches, too).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 77
diff changeset
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org