Package org.apache.tapestry5.ioc.util

## Class LocalizedNameGenerator

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

- All Implemented Interfaces:
    `java.lang.Iterable<java.lang.String>`, `java.util.Iterator<java.lang.String>`

      public class LocalizedNameGenerator
      extends java.lang.Object
      implements java.util.Iterator<java.lang.String>, java.lang.Iterable<java.lang.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 | Description
    --- | ---
    `LocalizedNameGenerator​(java.lang.String path, java.util.Locale locale)` | Creates a new generator for the given path and locale.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.Locale` | `getCurrentLocale()` |
    `boolean` | `hasNext()` | Returns true if there are more name variants to be returned, false otherwise.
    `java.util.Iterator<java.lang.String>` | `iterator()` | So that LNG may be used with the for loop.
    `java.lang.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.lang.Iterable

      `forEach, spliterator`

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

      `forEachRemaining`

- - ### Constructor Detail

    - #### LocalizedNameGenerator

          public LocalizedNameGenerator​(java.lang.String path,
                                        java.util.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 `java.util.Iterator<java.lang.String>`

    - #### next

          public java.lang.String next()

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

    - #### getCurrentLocale

          public java.util.Locale getCurrentLocale()

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `java.util.Iterator<java.lang.String>`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### iterator

          public java.util.Iterator<java.lang.String> iterator()

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