ch.qos.cal10n.verifier
Class AbstractMessageKeyVerifier

java.lang.Object
  extended by ch.qos.cal10n.verifier.AbstractMessageKeyVerifier
All Implemented Interfaces:
IMessageKeyVerifier
Direct Known Subclasses:
MessageKeyVerifier, MessageKeyVerifierByTypeElement

public abstract class AbstractMessageKeyVerifier
extends 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
protected AbstractMessageKeyVerifier(String enumTypeAsStr, AnnotationExtractor annotationExtractor)
           
 
Method Summary
protected  Set<String> buildKeySetFromEnumeration(Enumeration<String> e)
           
protected  String extractCharsetForLocale(Locale locale)
           
protected abstract  List<String> extractKeysInEnum()
           
 String getBaseName()
          Get the base name for the resource bundle family as specified in the enumType (via annotations)
 String getEnumTypeAsStr()
          Get the name of enum type to this verifier is related to to.
 String[] getLocaleNames()
          Get the locales specified in the enumType (via annotations)
protected abstract  CAL10NBundleFinder getResourceBundleFinder()
           
 List<String> typeIsolatedVerify(Locale locale)
          Same as IMessageKeyVerifier.verify(Locale) except that the return type is List.
 List<Cal10nError> verify(Locale locale)
          Verify that the keys defined in the enumClass match those found in the resource bundle corresponding to a certain locale
 List<Cal10nError> verifyAllLocales()
          Verify all declared locales in one step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessageKeyVerifier

protected AbstractMessageKeyVerifier(String enumTypeAsStr,
                                     AnnotationExtractor annotationExtractor)
Method Detail

getEnumTypeAsStr

public String getEnumTypeAsStr()
Description copied from interface: IMessageKeyVerifier
Get the name of enum type to this verifier is related to to.

Specified by:
getEnumTypeAsStr in interface IMessageKeyVerifier
Returns:

extractCharsetForLocale

protected String extractCharsetForLocale(Locale locale)

extractKeysInEnum

protected abstract List<String> extractKeysInEnum()

getLocaleNames

public String[] getLocaleNames()
Description copied from interface: IMessageKeyVerifier
Get the locales specified in the enumType (via annotations)

Specified by:
getLocaleNames in interface IMessageKeyVerifier
Returns:

getBaseName

public 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 interface IMessageKeyVerifier
Returns:

verify

public List<Cal10nError> verify(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 interface IMessageKeyVerifier
Returns:

getResourceBundleFinder

protected abstract CAL10NBundleFinder getResourceBundleFinder()

typeIsolatedVerify

public List<String> typeIsolatedVerify(Locale locale)
Description copied from interface: IMessageKeyVerifier
Same as IMessageKeyVerifier.verify(Locale) except that the return type is List.

Specified by:
typeIsolatedVerify in interface IMessageKeyVerifier
Returns:

buildKeySetFromEnumeration

protected Set<String> buildKeySetFromEnumeration(Enumeration<String> e)

verifyAllLocales

public List<Cal10nError> verifyAllLocales()
Verify all declared locales in one step.

Specified by:
verifyAllLocales in interface IMessageKeyVerifier
Returns:


Copyright © 2009-2013 QOS.ch. All Rights Reserved.