checkers.i18n
Class KeyLookupChecker

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by com.sun.source.util.AbstractTypeProcessor
          extended by checkers.source.SourceChecker
              extended by checkers.basetype.BaseTypeChecker
                  extended by checkers.i18n.KeyLookupChecker
All Implemented Interfaces:
Processor

@TypeQualifiers(value={LocalizableKey.class,Unqualified.class})
@SupportedOptions(value={"propfile","bundlename"})
public class KeyLookupChecker
extends BaseTypeChecker

A type-checker that checks that only valid localizable keys are used when using localizing methods (e.g. ResourceBundle.getString(String)). Currently, the checker supports two methods for localization checks:

  1. Properties files: A common method for localization using a properties file, mapping the localization keys to localized messages. Programmers pass the property file location via propfile option (e.g. -Apropfile=/path/to/messages.properties)
  2. ResourceBundle: The proper recommended mechanism for localization. Prograppers pass the baseName name of the bundle via bundlename (e.g. -Abundlename=MyResource. The checker uses the resource associdated with the default Locale in the compilation system.


Field Summary
Modifier and Type Field and Description
 
Fields inherited from class checkers.source.SourceChecker
currentPath, currentRoot, env, messager, messages, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
Constructor and Description
KeyLookupChecker()
           
 
Method Summary
Modifier and Type Method and Description
 Set<String> getLocalizableKeys()
          Returns a set of the valid keys that can be localized.
 void init(ProcessingEnvironment env)
          
 
Methods inherited from class checkers.basetype.BaseTypeChecker
createFactory, createQualifierHierarchy, createSourceVisitor, createSupportedTypeQualifiers, createTypeHierarchy, getQualifierHierarchy, getSupportedLintOptions, getSupportedTypeQualifiers, isAssignable, isSubtype, isValidUse
 
Methods inherited from class checkers.source.SourceChecker
getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, message, report, typeProcess
 
Methods inherited from class com.sun.source.util.AbstractTypeProcessor
process, typeProcessingOver
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyLookupChecker

public KeyLookupChecker()
Method Detail

init

public void init(ProcessingEnvironment env)
Description copied from class: SourceChecker

Specified by:
init in interface Processor
Overrides:
init in class BaseTypeChecker
See Also:
AbstractProcessor.init(ProcessingEnvironment)

getLocalizableKeys

public Set<String> getLocalizableKeys()
Returns a set of the valid keys that can be localized.