Class TypeUtil


  • public class TypeUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <V> V cast​(java.lang.Class<? extends V> clazz, java.lang.Object value)  
      static java.lang.Object cast​(org.dmg.pmml.DataType dataType, java.lang.Object value)  
      static boolean equals​(org.dmg.pmml.DataType dataType, java.lang.Object value, java.lang.Object referenceValue)  
      static java.lang.String format​(java.lang.Object value)  
      static org.dmg.pmml.DataType getCommonDataType​(org.dmg.pmml.DataType left, org.dmg.pmml.DataType right)  
      static org.dmg.pmml.DataType getConstantDataType​(java.lang.Object value)  
      static org.dmg.pmml.DataType getConstantDataType​(java.lang.String value)  
      static org.dmg.pmml.DataType getDataType​(java.lang.Object value)  
      static org.dmg.pmml.DataType getDataType​(java.util.Collection<?> values)  
      static org.dmg.pmml.OpType getOpType​(org.dmg.pmml.DataType dataType)  
      static java.lang.Object parse​(org.dmg.pmml.DataType dataType, java.lang.String value)  
      static java.lang.Object parseOrCast​(org.dmg.pmml.DataType dataType, java.lang.Object value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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)