Package ch.qos.cal10n.verifier
Class AbstractMessageKeyVerifier
- java.lang.Object
-
- ch.qos.cal10n.verifier.AbstractMessageKeyVerifier
-
- All Implemented Interfaces:
IMessageKeyVerifier
- Direct Known Subclasses:
MessageKeyVerifier
,MessageKeyVerifierByTypeElement
public abstract class AbstractMessageKeyVerifier extends java.lang.Object implements IMessageKeyVerifier
Abstract class for verifying that for a given an enum type, the keys match those found in the corresponding resource bundles.This class contains the bundle verification logic. Logic for extracting locate and key information should be provided by derived classes.
- Since:
- 0.8
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMessageKeyVerifier(java.lang.String enumTypeAsStr, AnnotationExtractor annotationExtractor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<java.lang.String>
buildKeySetFromEnumeration(java.util.Enumeration<java.lang.String> e)
protected java.lang.String
extractCharsetForLocale(java.util.Locale locale)
protected abstract java.util.List<java.lang.String>
extractKeysInEnum()
java.lang.String
getBaseName()
Get the base name for the resource bundle family as specified in the enumType (via annotations)java.lang.String
getEnumTypeAsStr()
Get the name of enum type to this verifier is related to to.java.lang.String[]
getLocaleNames()
Get the locales specified in the enumType (via annotations)protected abstract CAL10NBundleFinder
getResourceBundleFinder()
java.util.List<java.lang.String>
typeIsolatedVerify(java.util.Locale locale)
Same asIMessageKeyVerifier.verify(Locale)
except that the return type is List. java.util.List<Cal10nError>
verify(java.util.Locale locale)
Verify that the keys defined in the enumClass match those found in the resource bundle corresponding to a certain localejava.util.List<Cal10nError>
verifyAllLocales()
Verify all declared locales in one step.
-
-
-
Constructor Detail
-
AbstractMessageKeyVerifier
protected AbstractMessageKeyVerifier(java.lang.String enumTypeAsStr, AnnotationExtractor annotationExtractor)
-
-
Method Detail
-
getEnumTypeAsStr
public java.lang.String getEnumTypeAsStr()
Description copied from interface:IMessageKeyVerifier
Get the name of enum type to this verifier is related to to.- Specified by:
getEnumTypeAsStr
in interfaceIMessageKeyVerifier
- Returns:
-
extractCharsetForLocale
protected java.lang.String extractCharsetForLocale(java.util.Locale locale)
-
extractKeysInEnum
protected abstract java.util.List<java.lang.String> extractKeysInEnum()
-
getLocaleNames
public java.lang.String[] getLocaleNames()
Description copied from interface:IMessageKeyVerifier
Get the locales specified in the enumType (via annotations)- Specified by:
getLocaleNames
in interfaceIMessageKeyVerifier
- Returns:
-
getBaseName
public java.lang.String getBaseName()
Description copied from interface:IMessageKeyVerifier
Get the base name for the resource bundle family as specified in the enumType (via annotations)- Specified by:
getBaseName
in interfaceIMessageKeyVerifier
- Returns:
-
verify
public java.util.List<Cal10nError> verify(java.util.Locale locale)
Description copied from interface:IMessageKeyVerifier
Verify that the keys defined in the enumClass match those found in the resource bundle corresponding to a certain locale- Specified by:
verify
in interfaceIMessageKeyVerifier
- Returns:
-
getResourceBundleFinder
protected abstract CAL10NBundleFinder getResourceBundleFinder()
-
typeIsolatedVerify
public java.util.List<java.lang.String> typeIsolatedVerify(java.util.Locale locale)
Description copied from interface:IMessageKeyVerifier
Same asIMessageKeyVerifier.verify(Locale)
except that the return type is List. - Specified by:
typeIsolatedVerify
in interfaceIMessageKeyVerifier
- Returns:
-
buildKeySetFromEnumeration
protected java.util.Set<java.lang.String> buildKeySetFromEnumeration(java.util.Enumeration<java.lang.String> e)
-
verifyAllLocales
public java.util.List<Cal10nError> verifyAllLocales()
Verify all declared locales in one step.- Specified by:
verifyAllLocales
in interfaceIMessageKeyVerifier
- Returns:
-
-