Package com.adobe.acs.commons.data
Class Variant
- java.lang.Object
-
- com.adobe.acs.commons.data.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVariant.CellType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TasType(Class<T> type)voidclear()static <S,D>
Dconvert(S val, Class<D> destType)booleanisEmpty()booleanisStringTruthy(String s)Truthiness is any non-empty string that looks like a non-zero number or looks like it is True, Yes, or X<T> voidsetValue(T val)BooleantoBoolean()DatetoDate()DoubletoDouble()LongtoLong()StringtoString()
-
-
-
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)
-
-