com.google.gwt.i18n.rebind
Class AnnotationsResource

java.lang.Object
  extended by com.google.gwt.i18n.rebind.AbstractResource
      extended by com.google.gwt.i18n.rebind.AnnotationsResource

public class AnnotationsResource
extends AbstractResource

AbstractResource implementation which looks up text annotations on classes.


Nested Class Summary
static class AnnotationsResource.AnnotationsError
          An exception indicating there was some problem with an annotation.
static class AnnotationsResource.ArgumentInfo
          Class for argument information, used for export.
 
Nested classes/interfaces inherited from class com.google.gwt.i18n.rebind.AbstractResource
AbstractResource.MissingResourceException, AbstractResource.ResourceList
 
Field Summary
 
Fields inherited from class com.google.gwt.i18n.rebind.AbstractResource
REPORT_KEYS_THRESHOLD
 
Constructor Summary
AnnotationsResource(TreeLogger logger, JClassType clazz, GwtLocale locale, boolean isConstants)
          Create a resource that supplies data from i18n-related annotations.
 
Method Summary
 void addToKeySet(java.util.Set<java.lang.String> s)
           
 java.lang.Iterable<AnnotationsResource.ArgumentInfo> argumentsIterator(java.lang.String key)
           
 java.lang.String getDescription(java.lang.String key)
           
 java.util.Collection<java.lang.String> getExtensions(java.lang.String key)
           
static java.lang.String getKey(TreeLogger logger, KeyGenerator keyGenerator, JMethod method, boolean isConstants)
          Returns the key for a given method.
static KeyGenerator getKeyGenerator(JClassType targetClass)
          Returns a suitable key generator for the specified class.
 java.lang.String getMeaning(java.lang.String key)
           
 java.lang.String getStringExt(java.lang.String key, java.lang.String extension)
          Get a key with an extension.
 boolean notEmpty()
           
 java.lang.String toString()
           
 
Methods inherited from class com.google.gwt.i18n.rebind.AbstractResource
getRequiredString, getRequiredStringExt, getString, keySet, toVerboseString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationsResource

public AnnotationsResource(TreeLogger logger,
                           JClassType clazz,
                           GwtLocale locale,
                           boolean isConstants)
                    throws AnnotationsResource.AnnotationsError
Create a resource that supplies data from i18n-related annotations.

Parameters:
logger -
clazz -
locale -
isConstants -
Throws:
AnnotationsResource.AnnotationsError - if there is a fatal error while processing annotations
Method Detail

getKey

public static java.lang.String getKey(TreeLogger logger,
                                      KeyGenerator keyGenerator,
                                      JMethod method,
                                      boolean isConstants)
Returns the key for a given method. If null is returned, an error message has already been logged.

Parameters:
logger -
keyGenerator -
method -
isConstants -
Returns:
null if unable to get or compute the key for this method, otherwise the key is returned

getKeyGenerator

public static KeyGenerator getKeyGenerator(JClassType targetClass)
                                    throws AnnotationsResource.AnnotationsError
Returns a suitable key generator for the specified class.

Parameters:
targetClass -
Returns:
KeyGenerator instance, guaranteed to not be null
Throws:
AnnotationsResource.AnnotationsError - if a specified KeyGenerator cannot be created

addToKeySet

public void addToKeySet(java.util.Set<java.lang.String> s)

argumentsIterator

public java.lang.Iterable<AnnotationsResource.ArgumentInfo> argumentsIterator(java.lang.String key)

getDescription

public java.lang.String getDescription(java.lang.String key)

getExtensions

public java.util.Collection<java.lang.String> getExtensions(java.lang.String key)
Overrides:
getExtensions in class AbstractResource

getMeaning

public java.lang.String getMeaning(java.lang.String key)

getStringExt

public java.lang.String getStringExt(java.lang.String key,
                                     java.lang.String extension)
Description copied from class: AbstractResource
Get a key with an extension. Identical to getString() if extension is null.

Specified by:
getStringExt in class AbstractResource
Parameters:
key - to lookup
extension - extension of the key, nullable
Returns:
string or null

notEmpty

public boolean notEmpty()
Overrides:
notEmpty in class AbstractResource
Returns:
true if this resource has any keys

toString

public java.lang.String toString()
Overrides:
toString in class AbstractResource