Package org.jpmml.evaluator
Class TypeUtil
- java.lang.Object
-
- org.jpmml.evaluator.TypeUtil
-
public class TypeUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V> Vcast(java.lang.Class<? extends V> clazz, java.lang.Object value)static java.lang.Objectcast(org.dmg.pmml.DataType dataType, java.lang.Object value)static booleanequals(org.dmg.pmml.DataType dataType, java.lang.Object value, java.lang.Object referenceValue)static java.lang.Stringformat(java.lang.Object value)static org.dmg.pmml.DataTypegetCommonDataType(org.dmg.pmml.DataType left, org.dmg.pmml.DataType right)static org.dmg.pmml.DataTypegetConstantDataType(java.lang.Object value)static org.dmg.pmml.DataTypegetConstantDataType(java.lang.String value)static org.dmg.pmml.DataTypegetDataType(java.lang.Object value)static org.dmg.pmml.DataTypegetDataType(java.util.Collection<?> values)static org.dmg.pmml.OpTypegetOpType(org.dmg.pmml.DataType dataType)static java.lang.Objectparse(org.dmg.pmml.DataType dataType, java.lang.String value)static java.lang.ObjectparseOrCast(org.dmg.pmml.DataType dataType, java.lang.Object value)
-
-
-
Method Detail
-
format
public static java.lang.String format(java.lang.Object value)
-
parseOrCast
public static java.lang.Object parseOrCast(org.dmg.pmml.DataType dataType, java.lang.Object value)- Throws:
java.lang.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 java.lang.Object parse(org.dmg.pmml.DataType dataType, java.lang.String value)- Throws:
java.lang.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, java.lang.Object value, java.lang.Object referenceValue)
-
getDataType
public static org.dmg.pmml.DataType getDataType(java.lang.Object value)
- Returns:
- The data type of the value.
-
getDataType
public static org.dmg.pmml.DataType getDataType(java.util.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 java.lang.Object cast(org.dmg.pmml.DataType dataType, java.lang.Object value)- Throws:
TypeCheckException- If the value cannot be cast to the requested representation.
-
cast
public static <V> V cast(java.lang.Class<? extends V> clazz, java.lang.Object value)
-
getConstantDataType
public static org.dmg.pmml.DataType getConstantDataType(java.lang.Object value)
-
getConstantDataType
public static org.dmg.pmml.DataType getConstantDataType(java.lang.String value)
-
-