Module org.apache.wicket.core
Class ResourceNameIterator
java.lang.Object
org.apache.wicket.core.util.resource.locator.ResourceNameIterator
- All Implemented Interfaces:
Iterator<String>
,IResourceNameIterator
- Direct Known Subclasses:
EmptyResourceNameIterator
Contains the logic to locate a resource based on a path, style (see
Session
), variation, locale and extension strings. The full filename
will be built like:
<path>_<variation>_<style>_<locale>.<extension>.
Resource matches will be attempted in the following order:
- <path>_<variation>_<style>_<locale>.<extension>
- <path>_<variation>_<style>.<extension>
- <path>_<style>_<locale>.<extension>
- <path>_<style>.<extension>
- <path>_<variation>_<locale>.<extension>
- <path>_<variation>.<extension>
- <path>_<locale>.<extension>
- <path>.<extension>
Locales may contain a language, a country and a region or variant. Combinations of these components will be attempted in the following order:
- locale.toString() see javadoc for Locale for more details
- <language>_<country>
- <language>
- Author:
- Juergen Donnerstag
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal String
Get the exact filename extension used for the latest resource path.final Locale
Get the exact Locale which has been used for the latest resource path.final String
getStyle()
Get the exact Style which has been used for the latest resource path.final String
Get the exact Variation which has been used for the latest resource path.boolean
hasNext()
protected ExtensionResourceNameIterator
newExtensionResourceNameIterator
(Iterable<String> extensions) protected LocaleResourceNameIterator
newLocaleResourceNameIterator
(Locale locale, boolean strict) protected StyleAndVariationResourceNameIterator
newStyleAndVariationResourceNameIterator
(String style, String variation) next()
void
remove()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ResourceNameIterator
public ResourceNameIterator(String path, String style, String variation, Locale locale, Iterable<String> extensions, boolean strict) Construct.- Parameters:
path
- The path of the resource. In case the parameter 'extensions' is null, the path will be checked and if a filename extension is present, it'll be used instead.style
- A theme or style (seeSession
)variation
- The component's variation (of the style)locale
- The Locale to applyextensions
- the filename's extensionsstrict
- If false, weaker combinations of style, locale, etc. are tested as well
-
-
Method Details
-
getLocale
Get the exact Locale which has been used for the latest resource path.- Specified by:
getLocale
in interfaceIResourceNameIterator
- Returns:
- current Locale
-
getStyle
Get the exact Style which has been used for the latest resource path.- Specified by:
getStyle
in interfaceIResourceNameIterator
- Returns:
- current Style
-
getVariation
Get the exact Variation which has been used for the latest resource path.- Specified by:
getVariation
in interfaceIResourceNameIterator
- Returns:
- current Variation
-
getExtension
Get the exact filename extension used for the latest resource path.- Specified by:
getExtension
in interfaceIResourceNameIterator
- Returns:
- current filename extension
-
hasNext
-
next
-
toString
-
newLocaleResourceNameIterator
- Parameters:
locale
-strict
-- Returns:
- New iterator
-
newStyleAndVariationResourceNameIterator
protected StyleAndVariationResourceNameIterator newStyleAndVariationResourceNameIterator(String style, String variation) - Parameters:
style
-variation
-- Returns:
- new iterator
-
newExtensionResourceNameIterator
protected ExtensionResourceNameIterator newExtensionResourceNameIterator(Iterable<String> extensions) - Parameters:
extensions
-- Returns:
- New iterator
-
remove
-