public class Locales extends Object implements Serializable
Constructor and Description |
---|
Locales(Set locales)
Constructs a
Locales using the
passed Set . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Compares the specified object (the
Object passed
in o ) with this Locales
object for equality. |
Locale |
getFirstSupportedLocale(List locales)
Iterates through the passed
List of Locale s
and returns the first Locale that is
supported by the UI (as defined by isLocaleSupported() ),
or null , if none of the Locale s in
the passed array are supported by the UI. |
Locale |
getFirstSupportedLocale(Locale[] locales)
Looks through the passed array of
Locale s
(in the order they appear in the array)
and returns the first Locale that is
supported by the UI (as defined by isLocaleSupported() ),
or null , if none of the Locale s in
the passed array are supported by the UI. |
Set |
getLocales()
Returns an unmodifiable
java.util.Set that contains
java.util.Locale objects, one for each locale supported
by the UI generated by the UI factory stored in
the marshalled object of the same UIDescriptor . |
int |
hashCode()
Returns the hash code value for this
Locales object. |
boolean |
isLocaleSupported(Locale locale)
Indicates whether or not a locale is supported
by the UI generated by the UI factory stored in
the marshalled object of the same
UIDescriptor . |
Iterator |
iterator()
Returns an iterator over the set of
java.util.Locale
objects, one for each locale supported
by the UI generated by the UI factory stored in
the marshalled object of the same UIDescriptor . |
public Locales(Set locales)
Locales
using the
passed Set
. The Set
can
be mutable or immutable, and must contain only
java.util.Locale
objects. Each Locale
must
represent a locale that is supported by the UI generated
by the UI factory stored in marshalled form in the
same UIDescriptor
. This constructor copies
the contents of the passed Set
into a
serializable read-only Set
that has a
consistent serialized form across all VMs.locales
- A Set
of Locale
objects. Each element must be non-null and an instance
of java.util.Locale
.NullPointerException
- if locales
is null
or any element of locales
set is null
.IllegalArgumentException
- if any non-null element of
locales
set is not an instance of
java.util.Locale
.public boolean isLocaleSupported(Locale locale)
UIDescriptor
.
This method returns true
only if the passed
Locale
exactly matches a Locale
supported by the UI, as defined by the equals()
method of class java.util.Locale
. For example, imagine the UI supports the
"en" (General English) locale, but not the "en_US" (US English) locale.
Then, if "en_US" is passed to this method, the method will return
false
.locale
- the locale to checkNullPointerException
- if locale
is null
.public Locale getFirstSupportedLocale(Locale[] locales)
Locale
s
(in the order they appear in the array)
and returns the first Locale
that is
supported by the UI (as defined by isLocaleSupported()
),
or null
, if none of the Locale
s in
the passed array are supported by the UI.locales
- an array of locales in order of most desired to
least desiredNullPointerException
- if locales
is null
.public Locale getFirstSupportedLocale(List locales)
List
of Locale
s
and returns the first Locale
that is
supported by the UI (as defined by isLocaleSupported()
),
or null
, if none of the Locale
s in
the passed array are supported by the UI.locales
- a List
of locales in order of most
desired to least desiredNullPointerException
- if locales
is null
.public Iterator iterator()
java.util.Locale
objects, one for each locale supported
by the UI generated by the UI factory stored in
the marshalled object of the same UIDescriptor
.
The returned Iterator
does not support
remove()
.public Set getLocales()
java.util.Set
that contains
java.util.Locale
objects, one for each locale supported
by the UI generated by the UI factory stored in
the marshalled object of the same UIDescriptor
.public boolean equals(Object o)
Object
passed
in o
) with this Locales
object for equality. Returns true if the specified object
is not null, if the specified object's class is
Locales
, if the two sets of
supported locales are the same size, and if every locale mentioned in the
specified Locales
object (passed in o
) is also mentioned
in this Locales
object.Copyright © 2016–2018. All rights reserved.