Package sk.ipesoft.d2000.d2japi.unival
Class UnivalValueUtils
- java.lang.Object
-
- sk.ipesoft.d2000.d2japi.unival.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 bytype
parameterstatic 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 bytype
parameter.static <T> sk.ipesoft.d2000.base.UnivalValue<T>
createUnivalValue(T value)
Create appropriateUnivalValue
instance with its value set to thevalue
parameter.static sk.ipesoft.d2000.base.UnivalValue<?>
createUnivalValueUntyped(java.lang.Object value)
Create appropriateUnivalValue
instance fromvalue
.static sk.ipesoft.d2000.base.UnivalType
resolveUnivalType(java.lang.Object value)
Determine unival type fromvalue
parameter.
-
-
-
Method Detail
-
createUnivalValue
public static <T> sk.ipesoft.d2000.base.UnivalValue<T> createUnivalValue(T value)
Create appropriateUnivalValue
instance with its value set to thevalue
parameter. Actual type of the result is derived from the actual type of thevalue
parameter according to the following rules:UnivalNan
fornull
,UnivalInt
forInteger
,UnivalReal
forDouble
,UnivalText
forString
,UnivalBoolean
forBoolean
,UnivalTime
forDate
,- throws
IllegalArgumentException
otherwise.
- Type Parameters:
T
- actual type ofvalue
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 bytype
parameter.- Parameters:
value
- valid value ornull
for invalidtype
- 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 bytype
parameter- Parameters:
value
- valid value ornull
for invalidtype
- unival type- Returns:
- new instance
-
createUnivalValueUntyped
public static sk.ipesoft.d2000.base.UnivalValue<?> createUnivalValueUntyped(java.lang.Object value)
Create appropriateUnivalValue
instance fromvalue
.- 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 fromvalue
parameter.null
UnivalType.nan
Integer
UnivalType.integer
Double
UnivalType.real
String
UnivalType.text
Boolean
orVBool
UnivalType.bool
Long
orDate
UnivalType.time
VAlarm
UnivalType.alarm
VStation
UnivalType.station
VProcess
UnivalType.process
VQval
UnivalType.qval
- anything else
- throws IllegalArgumentException
- Parameters:
value
- inspected value- Returns:
-
-