org.apache.tapestry5.ioc.util

## Class LocalizedNameGenerator

- java.lang.Object
- - org.apache.tapestry5.ioc.util.LocalizedNameGenerator

- All Implemented Interfaces:
    Iterable<String>, Iterator<String>

      public class LocalizedNameGenerator
      extends Object
      implements Iterator<String>, Iterable<String>

  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

    Constructors
    Constructor and Description
    `LocalizedNameGenerator(String path, Locale locale)` Creates a new generator for the given path and locale.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Locale` | `getCurrentLocale()`
    `boolean` | `hasNext()` Returns true if there are more name variants to be returned, false otherwise.
    `Iterator<String>` | `iterator()` So that LNG may be used with the for loop.
    `String` | `next()` Returns the next localized variant.
    `void` | `remove()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### LocalizedNameGenerator

          public LocalizedNameGenerator(String path,
                                        Locale locale)

      Creates a new generator for the given path and locale.
      Parameters:
        `path` - non-blank path
        `locale` - non-null locale

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Returns true if there are more name variants to be returned, false otherwise.
      Specified by:
        `hasNext` in interface `Iterator<String>`

    - #### next

          public String next()

      Returns the next localized variant.
      Specified by:
        `next` in interface `Iterator<String>`
      Throws:
        `NoSuchElementException` - if all variants have been returned.

    - #### getCurrentLocale

          public Locale getCurrentLocale()

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<String>`
      Throws:
        `UnsupportedOperationException`

    - #### iterator

          public Iterator<String> iterator()

      So that LNG may be used with the for loop.
      Specified by:
        `iterator` in interface `Iterable<String>`

5.6.0 - Copyright © 2003-2020 The Apache Software Foundation.