Class BooleanTypeConverter

  • All Implemented Interfaces:
    TypeConverter

    @MetaInfServices(TypeConverter.class)
    public class BooleanTypeConverter
    extends Object
    implements TypeConverter
    Converts object into Boolean values. Conversion is possible for the following types:
    • JsonEntry if the entry is a primitive
    • Booleans
    • Number: True if the integer value of the number is 0, False otherwise
    • Charsequence: using Boolean.parseBoolean
    Author:
    David B. Bracewell
    • Constructor Detail

      • BooleanTypeConverter

        public BooleanTypeConverter()
    • Method Detail

      • convert

        public Object convert​(Object object,
                              Type... parameters)
                       throws TypeConversionException
        Description copied from interface: TypeConverter
        Converts an object from one type to another.
        Specified by:
        convert in interface TypeConverter
        Parameters:
        object - the source object
        parameters - the optional type parameters when using Generics.
        Returns:
        the converted object
        Throws:
        TypeConversionException - the source object was not able to be converted to the target type
      • getConversionType

        public Class[] getConversionType()
        Description copied from interface: TypeConverter
        Array of classes that this type converter can convert objects to
        Specified by:
        getConversionType in interface TypeConverter
        Returns:
        the classes that this converter can convert to