checkers.i18n
Class KeyLookupChecker
java.lang.Object
javax.annotation.processing.AbstractProcessor
com.sun.source.util.AbstractTypeProcessor
checkers.source.SourceChecker
checkers.basetype.BaseTypeChecker
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:
- 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
)
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.
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KeyLookupChecker
public KeyLookupChecker()
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.