Class UnivalValueUtils



  • public class UnivalValueUtils
    extends java.lang.Object
    Utility class for operations with univals.
    • Constructor Summary

      Constructors 
      Constructor Description
      UnivalValueUtils​()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValue​(java.lang.Object value, sk.ipesoft.d2000.base.UnivalType type)
      Create new instance of UnivalValue with default unival value type determined by type parameter
      static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValue​(java.lang.Object value, sk.ipesoft.d2000.base.UnivalValueType type)
      Create new instance of UnivalValue with actual unival type determined by type parameter.
      static <T> sk.ipesoft.d2000.base.UnivalValue<T> createUnivalValue​(T value)
      Create appropriate UnivalValue instance with its value set to the value parameter.
      static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValueUntyped​(java.lang.Object value)
      Create appropriate UnivalValue instance from value.
      static sk.ipesoft.d2000.base.UnivalType resolveUnivalType​(java.lang.Object value)
      Determine unival type from value parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UnivalValueUtils

        public UnivalValueUtils​()
    • Method Detail

      • createUnivalValue

        public static <T> sk.ipesoft.d2000.base.UnivalValue<T> createUnivalValue​(T value)
        Create appropriate UnivalValue instance with its value set to the value parameter. Actual type of the result is derived from the actual type of the value parameter according to the following rules:
        1. UnivalNan for null,
        2. UnivalInt for Integer,
        3. UnivalReal for Double,
        4. UnivalText for String,
        5. UnivalBoolean for Boolean,
        6. UnivalTime for Date,
        7. throws IllegalArgumentException otherwise.
        Type Parameters:
        T - actual type of value parameter
        Parameters:
        value - value of resulting unival.
        Returns:
        Unival object of appropriate type with value of value parameter.
      • createUnivalValue

        public static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValue​(java.lang.Object value,
                                                                             sk.ipesoft.d2000.base.UnivalValueType type)
        Create new instance of UnivalValue with actual unival type determined by type parameter.
        Parameters:
        value - valid value or null for invalid
        type - unival value type
        Returns:
        new instance
      • createUnivalValue

        public static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValue​(java.lang.Object value,
                                                                             sk.ipesoft.d2000.base.UnivalType type)
        Create new instance of UnivalValue with default unival value type determined by type parameter
        Parameters:
        value - valid value or null for invalid
        type - unival type
        Returns:
        new instance
      • createUnivalValueUntyped

        public static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValueUntyped​(java.lang.Object value)
        Create appropriate UnivalValue instance from value.
        Parameters:
        value - value to be wrapped in unival
        Returns:
        new unival object
      • resolveUnivalType

        public static sk.ipesoft.d2000.base.UnivalType resolveUnivalType​(java.lang.Object value)
        Determine unival type from value parameter.
        null
        UnivalType.nan
        Integer
        UnivalType.integer
        Double
        UnivalType.real
        String
        UnivalType.text
        Boolean or VBool
        UnivalType.bool
        Long or Date
        UnivalType.time
        VAlarm
        UnivalType.alarm
        VStation
        UnivalType.station
        VProcess
        UnivalType.process
        VQval
        UnivalType.qval
        anything else
        throws IllegalArgumentException
        Parameters:
        value - inspected value
        Returns: