Class Variant


  • @ProviderType
    public final class Variant
    extends Object
    Used to represent values that might be provided as one baseType but used as another. Avoids glue code and switch statements in other parts of the code especially dealing with data from spreadsheets.
    • Constructor Detail

      • Variant

        public Variant()
      • Variant

        public Variant​(T src)
      • Variant

        public Variant​(org.apache.poi.ss.usermodel.Cell src)
      • Variant

        public Variant​(org.apache.poi.ss.usermodel.Cell src,
                       Locale locale)
    • Method Detail

      • clear

        public void clear()
      • isEmpty

        public boolean isEmpty()
      • setValue

        public final <T> void setValue​(T val)
      • toLong

        public Long toLong()
      • toDouble

        public Double toDouble()
      • toDate

        public Date toDate()
      • toBoolean

        public Boolean toBoolean()
      • isStringTruthy

        public boolean isStringTruthy​(String s)
        Truthiness is any non-empty string that looks like a non-zero number or looks like it is True, Yes, or X
        Parameters:
        s - String to evaluate
        Returns:
        True if it is truthy, otherwise false
      • asType

        public <T> T asType​(Class<T> type)
      • convert

        public static <S,​D> D convert​(S val,
                                            Class<D> destType)