Class ConverterLanguageToBoolean<T,​I>

  • Type Parameters:
    T - Type of the bean to be manipulated
    I - Type of the index into multivalued fields
    All Implemented Interfaces:
    BeanField<T,​I>
    Direct Known Subclasses:
    ConvertFrenchToBoolean, ConvertGermanToBoolean

    public abstract class ConverterLanguageToBoolean<T,​I>
    extends AbstractBeanField<T,​I>
    A base class for any converter to and from booleans when the string values have been or should be localized to a specific language.
    • Constructor Detail

      • ConverterLanguageToBoolean

        public ConverterLanguageToBoolean()
    • Method Detail

      • getLocalizedTrue

        protected abstract java.lang.String getLocalizedTrue()
        This is the string for "true" in the localized language. This value will be used on converting from a boolean to a string.
        Returns:
        The canonical name of true in this language
      • getLocalizedFalse

        protected abstract java.lang.String getLocalizedFalse()
        This is the string for "false" in the localized language. This value will be used on converting from a boolean to a string.
        Returns:
        The canonical name of false in this language
      • getAllLocalizedTrueValues

        protected abstract java.lang.String[] getAllLocalizedTrueValues()
        This represents a list of all values accepted as "true". Any language will have more than one way to say "true", such as "yes", "y", or "1". This array should list all possibilities. Comparison is done in a case-insensitive fashion.
        Returns:
        An array of all "true" strings
      • getAllLocalizedFalseValues

        protected abstract java.lang.String[] getAllLocalizedFalseValues()
        This represents a list of all values accepted as "false". Any language will have more than one way to say "false", such as "no", "n", or "0". This array should list all possibilities. Comparison is done in a case-insensitive fashion.
        Returns:
        An array of all "false" strings
      • convert

        protected java.lang.Object convert​(java.lang.String value)
                                    throws CsvDataTypeMismatchException
        Converts localized text into a Boolean. The comparisons are case-insensitive.
        Specified by:
        convert in class AbstractBeanField<T,​I>
        Parameters:
        value - String that should represent a Boolean
        Returns:
        Boolean
        Throws:
        CsvDataTypeMismatchException - If anything other than the explicitly translated pairs is found