line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AsposeWordsCloud::Object::BaseObject; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.6.0; |
4
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
22
|
use JSON qw(decode_json); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
131
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
9
|
1
|
|
|
1
|
|
5
|
use Module::Runtime qw(use_module); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
10
|
1
|
|
|
1
|
|
61
|
use Log::Any qw($log); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
11
|
1
|
|
|
1
|
|
266
|
use Date::Parse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
12
|
1
|
|
|
1
|
|
6
|
use DateTime; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
387
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# return json string |
23
|
|
|
|
|
|
|
sub to_hash { |
24
|
0
|
|
|
0
|
0
|
|
return decode_json(JSON->new->convert_blessed->encode( shift )); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# used by JSON for serialization |
28
|
|
|
|
|
|
|
sub TO_JSON { |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $_data = {}; |
31
|
0
|
|
|
|
|
|
foreach my $_key (%{$self->get_attribute_map}) { |
|
0
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if (defined $self->{$_key}) { |
33
|
0
|
|
|
|
|
|
$_data->{$self->get_attribute_map->{$_key}} = $self->{$_key}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return $_data; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# from json string |
40
|
|
|
|
|
|
|
sub from_hash { |
41
|
0
|
|
|
0
|
0
|
|
my ($self, $hash) = @_; |
42
|
|
|
|
|
|
|
# loop through attributes and use swagger_types to deserialize the data |
43
|
0
|
|
|
|
|
|
while ( my ($_key, $_type) = each %{$self->get_swagger_types }) { |
|
0
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ($_type =~ /^array\[/i) { # array |
|
|
0
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $_subclass = substr($_type, 6, -1); |
46
|
0
|
|
|
|
|
|
my @_array = (); |
47
|
0
|
|
|
|
|
|
foreach my $_element (@{$hash->{$self->get_attribute_map->{$_key}}}) { |
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
push @_array, $self->_deserialize($_subclass, $_element); |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
|
$self->{$_key} = \@_array; |
51
|
|
|
|
|
|
|
} elsif (defined $hash->{$_key}) { #hash(model), primitive, datetime |
52
|
0
|
|
|
|
|
|
$self->{$_key} = $self->_deserialize($_type, $hash->{$_key}); |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
$log->debugf("warning: %s not defined\n", $_key); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# deserialize non-array data |
62
|
|
|
|
|
|
|
sub _deserialize { |
63
|
0
|
|
|
0
|
|
|
my ($self, $type, $data) = @_; |
64
|
0
|
|
|
|
|
|
$log->debugf("deserializing %s with %s",Dumper($data), $type); |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if ($type eq 'DateTime') { |
|
|
0
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return DateTime->from_epoch(epoch => str2time($data)); |
68
|
|
|
|
|
|
|
} elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { |
69
|
0
|
|
|
|
|
|
return $data; |
70
|
|
|
|
|
|
|
} else { # hash(model) |
71
|
0
|
|
|
|
|
|
my $_instance = use_module("AsposeWordsCloud::Object::$type")->new; |
72
|
0
|
|
|
|
|
|
return $_instance->from_hash($data); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |