Package org.jpmml.evaluator
Class TypeUtil
- java.lang.Object
-
- org.jpmml.evaluator.TypeUtil
-
public class TypeUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V> Vcast(Class<? extends V> clazz, Object value)static Objectcast(org.dmg.pmml.DataType dataType, Object value)static booleanequals(org.dmg.pmml.DataType dataType, Object value, Object referenceValue)static Stringformat(Object value)static org.dmg.pmml.DataTypegetCommonDataType(org.dmg.pmml.DataType left, org.dmg.pmml.DataType right)static org.dmg.pmml.DataTypegetConstantDataType(Object value)static org.dmg.pmml.DataTypegetConstantDataType(String value)static org.dmg.pmml.DataTypegetDataType(Object value)static org.dmg.pmml.DataTypegetDataType(Collection<?> values)static org.dmg.pmml.OpTypegetOpType(org.dmg.pmml.DataType dataType)static Objectparse(org.dmg.pmml.DataType dataType, String value)static ObjectparseOrCast(org.dmg.pmml.DataType dataType, Object value)
-
-
-
Method Detail
-
parseOrCast
public static Object parseOrCast(org.dmg.pmml.DataType dataType, Object value)
- Throws:
IllegalArgumentException- If the value is a String, and it cannot be parsed to the requested representation.TypeCheckException- If the value is an Object other than String, and it cannot be cast to the requested representation.
-
parse
public static Object parse(org.dmg.pmml.DataType dataType, String value)
- Throws:
IllegalArgumentException- If the String representation of the value cannot be parsed to the requested representation.
-
equals
public static boolean equals(org.dmg.pmml.DataType dataType, Object value, Object referenceValue)
-
getDataType
public static org.dmg.pmml.DataType getDataType(Object value)
- Returns:
- The data type of the value.
-
getDataType
public static org.dmg.pmml.DataType getDataType(Collection<?> values)
-
getCommonDataType
public static org.dmg.pmml.DataType getCommonDataType(org.dmg.pmml.DataType left, org.dmg.pmml.DataType right)- Returns:
- The least restrictive data type of two numeric data types.
- See Also:
DataType.INTEGER,DataType.FLOAT,DataType.DOUBLE
-
getOpType
public static org.dmg.pmml.OpType getOpType(org.dmg.pmml.DataType dataType)
-
cast
public static Object cast(org.dmg.pmml.DataType dataType, Object value)
- Throws:
TypeCheckException- If the value cannot be cast to the requested representation.
-
getConstantDataType
public static org.dmg.pmml.DataType getConstantDataType(Object value)
-
getConstantDataType
public static org.dmg.pmml.DataType getConstantDataType(String value)
-
-