com.google.gwt.i18n.rebind
Class AbstractResource.ResourceList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<AbstractResource>
          extended by com.google.gwt.i18n.rebind.AbstractResource.ResourceList
All Implemented Interfaces:
java.lang.Iterable<AbstractResource>, java.util.Collection<AbstractResource>, java.util.List<AbstractResource>, java.util.Set<AbstractResource>
Enclosing class:
AbstractResource

public static class AbstractResource.ResourceList
extends java.util.AbstractList<AbstractResource>
implements java.util.Set<AbstractResource>

Encapsulates an ordered set of resources to search for translations.


Constructor Summary
AbstractResource.ResourceList()
           
 
Method Summary
 boolean add(AbstractResource element)
           
 void add(int index, AbstractResource element)
           
 void addToKeySet(java.util.Set<java.lang.String> s)
          Add all keys known by this ResourceList to the specified set.
 GwtLocale findLeastDerivedLocale(TreeLogger logger, GwtLocale locale)
          From the list of locales matched for any resources in this resource list, choose the one that is least derived from the original search locale.
 AbstractResource get(int index)
           
 AnnotationsResource getAnnotationsResource(TreeLogger logger, java.lang.String key)
          Return the first AnnotationsResource containing a specified key.
 java.util.Collection<java.lang.String> getExtension(java.lang.String key)
          Return the list of extensions available for a given key.
 PluralRule.PluralForm[] getPluralForms(java.lang.String key)
          Return the list of plural forms for a given key.
 java.lang.String getRequiredString(java.lang.String key)
          Return a translation for a key, or throw an exception.
 java.lang.String getRequiredStringExt(java.lang.String key, java.lang.String ext)
          Return a translation for a key/extension, or throw an exception.
 java.lang.String getString(java.lang.String key)
          Return a translation for a key, or null if not found.
 java.lang.String getStringExt(java.lang.String key, java.lang.String extension)
          Return a translation for a key/extension, or null if not found.
 int indexOf(java.lang.Object o)
           
 java.util.Iterator<AbstractResource> iterator()
           
 java.util.Set<java.lang.String> keySet()
           
 int lastIndexOf(java.lang.Object o)
           
 AbstractResource remove(int index)
           
 void setPluralForms(java.lang.String key, PluralRule.PluralForm[] forms)
          Set the plural forms associated with a given message.
 int size()
           
 
Methods inherited from class java.util.AbstractList
addAll, clear, equals, hashCode, listIterator, listIterator, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

AbstractResource.ResourceList

public AbstractResource.ResourceList()
Method Detail

add

public boolean add(AbstractResource element)
Specified by:
add in interface java.util.Collection<AbstractResource>
Specified by:
add in interface java.util.List<AbstractResource>
Specified by:
add in interface java.util.Set<AbstractResource>
Overrides:
add in class java.util.AbstractList<AbstractResource>

add

public void add(int index,
                AbstractResource element)
Specified by:
add in interface java.util.List<AbstractResource>
Overrides:
add in class java.util.AbstractList<AbstractResource>

addToKeySet

public void addToKeySet(java.util.Set<java.lang.String> s)
Add all keys known by this ResourceList to the specified set.

Parameters:
s - set to add keys to

findLeastDerivedLocale

public GwtLocale findLeastDerivedLocale(TreeLogger logger,
                                        GwtLocale locale)
From the list of locales matched for any resources in this resource list, choose the one that is least derived from the original search locale.

Parameters:
logger - logger to use
locale - originally requested locale
Returns:
least derived matched locale

get

public AbstractResource get(int index)
Specified by:
get in interface java.util.List<AbstractResource>
Specified by:
get in class java.util.AbstractList<AbstractResource>

getAnnotationsResource

public AnnotationsResource getAnnotationsResource(TreeLogger logger,
                                                  java.lang.String key)
Return the first AnnotationsResource containing a specified key.

Parameters:
logger -
key -
Returns:
first AnnotationsResource containing key, or null if none

getExtension

public java.util.Collection<java.lang.String> getExtension(java.lang.String key)
Return the list of extensions available for a given key.

Parameters:
key -
Returns:
collection of extensions for the given key

getPluralForms

public PluralRule.PluralForm[] getPluralForms(java.lang.String key)
Return the list of plural forms for a given key.

Parameters:
key -
Returns:
array of plural forms.

getRequiredString

public java.lang.String getRequiredString(java.lang.String key)
                                   throws AbstractResource.MissingResourceException
Return a translation for a key, or throw an exception.

Parameters:
key -
Returns:
translated string for key
Throws:
AbstractResource.MissingResourceException

getRequiredStringExt

public java.lang.String getRequiredStringExt(java.lang.String key,
                                             java.lang.String ext)
                                      throws AbstractResource.MissingResourceException
Return a translation for a key/extension, or throw an exception.

Parameters:
key -
ext - key extension, null if none
Returns:
translated string for key
Throws:
AbstractResource.MissingResourceException

getString

public java.lang.String getString(java.lang.String key)
Return a translation for a key, or null if not found.

Parameters:
key -
Returns:
translated string for key

getStringExt

public java.lang.String getStringExt(java.lang.String key,
                                     java.lang.String extension)
Return a translation for a key/extension, or null if not found.

Parameters:
key -
extension - key extension, null if none
Returns:
translated string for key

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List<AbstractResource>
Overrides:
indexOf in class java.util.AbstractList<AbstractResource>

iterator

public java.util.Iterator<AbstractResource> iterator()
Specified by:
iterator in interface java.lang.Iterable<AbstractResource>
Specified by:
iterator in interface java.util.Collection<AbstractResource>
Specified by:
iterator in interface java.util.List<AbstractResource>
Specified by:
iterator in interface java.util.Set<AbstractResource>
Overrides:
iterator in class java.util.AbstractList<AbstractResource>

keySet

public java.util.Set<java.lang.String> keySet()
Returns:
set of keys present across all resources

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List<AbstractResource>
Overrides:
lastIndexOf in class java.util.AbstractList<AbstractResource>

remove

public AbstractResource remove(int index)
Specified by:
remove in interface java.util.List<AbstractResource>
Overrides:
remove in class java.util.AbstractList<AbstractResource>

setPluralForms

public void setPluralForms(java.lang.String key,
                           PluralRule.PluralForm[] forms)
Set the plural forms associated with a given message.

Parameters:
key -
forms -

size

public int size()
Specified by:
size in interface java.util.Collection<AbstractResource>
Specified by:
size in interface java.util.List<AbstractResource>
Specified by:
size in interface java.util.Set<AbstractResource>
Specified by:
size in class java.util.AbstractCollection<AbstractResource>