Package org.apache.tapestry5.ioc.util
Class LocalizedNameGenerator
java.lang.Object
org.apache.tapestry5.ioc.util.LocalizedNameGenerator
Generates name variations for a given file name or path and a locale. The name variations
are provided in most-specific to least-specific order, so for a path of "Base.ext" and a Locale
of "en_US", the generated names would be "Base_en_US.ext", "Base_en.ext", "Base.ext".
Implements Iterable, so a LocalizedNameGenerator may be used directly in a for loop.
This class is not threadsafe.
- Since:
- 5.3
-
Constructor Summary
ConstructorsConstructorDescriptionLocalizedNameGenerator
(String path, Locale locale) Creates a new generator for the given path and locale. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
LocalizedNameGenerator
Creates a new generator for the given path and locale.- Parameters:
path
- non-blank pathlocale
- non-null locale
-
-
Method Details
-
hasNext
Returns true if there are more name variants to be returned, false otherwise. -
next
Returns the next localized variant.- Specified by:
next
in interfaceIterator<String>
- Throws:
NoSuchElementException
- if all variants have been returned.
-
getCurrentLocale
-
remove
- Specified by:
remove
in interfaceIterator<String>
- Throws:
UnsupportedOperationException
-
iterator
So that LNG may be used with the for loop.
-