-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Class_TypeUtil.xpp
104 lines (85 loc) · 2.39 KB
/
Class_TypeUtil.xpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// https://github.com/mazzy-ax/SysUtil
//
// Util-класс реализует только статические методы.
// не содержит внутри никаких значений.
// не имеет смысла создавать экземпляр этого класса.
//
abstract class TypeUtil
{
public static container integerTypes()
{
return [Types::Integer, Types::Int64, Types::Date, Types::Time];
}
public static boolean is(Types type, Types expectedType)
{
boolean ret = (type == expectedType || expectedType == Types::AnyType);
if( !ret )
{
ret = TypeUtil::isString(type) && TypeUtil::isString(expectedType);
}
return ret;
}
public static boolean isInteger(Types type)
{
boolean ret = confind(TypeUtil::integerTypes(), type);
return ret;
}
public static boolean isNumeric(Types type)
{
boolean ret = confind(TypeUtil::numericTypes(), type);
return ret;
}
public static boolean isPrimitive(Types type)
{
boolean ret;
switch( type )
{
case Types::String:
case Types::Integer:
case Types::Real:
case Types::Date:
case Types::Enum:
case Types::UtcDateTime:
case Types::RString:
case Types::VarString:
case Types::UserType:
case Types::Guid:
case Types::Int64:
case Types::Time:
ret = true;
/*
case Types::Container:
case Types::Record:
case Types::AnyType:
case Types::BLOB:
case Types::Class:
case Types::void:
return false;
*/
}
return ret;
}
public static boolean isString(Types type)
{
boolean ret = confind(TypeUtil::stringTypes(), type);
return ret;
}
public static boolean isUndefined(Types type)
{
boolean ret = (type == Types::AnyType);
return ret;
}
public static container numericTypes()
{
return [Types::Real, Types::Integer, Types::Int64];
}
public static container stringTypes()
{
return [Types::String, Types::RString, Types::VarString];
}
public static Types undefined()
{
return Types::AnyType;
}
}