Object/FilterColumn.pm untested

filter: Statementstmt 0.0% 0 / 105 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 22 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 142 CC 6 SCAR 15.1
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.5
1 =begin comment
2
3 Copyright (c) 2026 Aspose.Cells Cloud
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21
22 =end comment
23
24 =cut
25
26 package AsposeCellsCloud::Object::FilterColumn;
27
28 require 5.6.0;
29 use strict;
30 use warnings;
31 use utf8;
32 use JSON qw(decode_json);
33 use Data::Dumper;
34 use Module::Runtime qw(use_module);
35 use Log::Any qw($log);
36 use Date::Parse;
37 use DateTime;
38 use AsposeCellsCloud::Object::ColorFilter;
39 use AsposeCellsCloud::Object::CustomFilter;
40 use AsposeCellsCloud::Object::DynamicFilter;
41 use AsposeCellsCloud::Object::IconFilter;
42 use AsposeCellsCloud::Object::MultipleFilters;
43 use AsposeCellsCloud::Object::Top10Filter;
44
45
46 use base ("Class::Accessor", "Class::Data::Inheritable");
47
48
49
50 __PACKAGE__->mk_classdata('attribute_map' => {});
51 __PACKAGE__->mk_classdata('swagger_types' => {});
52 __PACKAGE__->mk_classdata('method_documentation' => {});
53 __PACKAGE__->mk_classdata('class_documentation' => {});
54
55 # new object
56 sub new {
57 my ($class, %args) = @_;
58
59 my $self = bless {}, $class;
60
61 foreach my $attribute (keys %{$class->attribute_map}) {
62 my $args_key = $class->attribute_map->{$attribute};
63 $self->$attribute( $args{ $args_key } );
64 }
65
66 return $self;
67 }
68
69 # return perl hash
70 sub to_hash {
71 return decode_json(JSON->new->convert_blessed->encode( shift ));
72 }
73
74 # used by JSON for serialization
75 sub TO_JSON {
76 my $self = shift;
77 my $_data = {};
78 foreach my $_key (keys %{$self->attribute_map}) {
79 if (defined $self->{$_key}) {
80 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
81 }
82 }
83 return $_data;
84 }
85
86 # from Perl hashref
87 sub from_hash {
88 my ($self, $hash) = @_;
89
90 # loop through attributes and use swagger_types to deserialize the data
91 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
92 my $_json_attribute = $self->attribute_map->{$_key};
93 if ($_type =~ /^array\[/i) { # array
94 my $_subclass = substr($_type, 6, -1);
95 my @_array = ();
96 foreach my $_element (@{$hash->{$_json_attribute}}) {
97 push @_array, $self->_deserialize($_subclass, $_element);
98 }
99 $self->{$_key} = \@_array;
100 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
101 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
102 } else {
103 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
104 }
105 }
106
107 return $self;
108 }
109
110 # deserialize non-array data
111 sub _deserialize {
112 my ($self, $type, $data) = @_;
113 $log->debugf("deserializing %s with %s",Dumper($data), $type);
114
115 if ($type eq 'DateTime') {
116 return DateTime->from_epoch(epoch => str2time($data));
117 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
118 return $data;
119 } else { # hash(model)
120 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
121 return $_instance->from_hash($data);
122 }
123 }
124
125
126 __PACKAGE__->class_documentation({description => ' Represents a filter for a single column. The Filter object is a member of the Filters collection ',
127 class => 'FilterColumn',
128 required => [], # TODO
129 } );
130
131
132 __PACKAGE__->method_documentation({
133 'field_index' => {
134 datatype => 'int',
135 base_name => 'FieldIndex',
136 description => 'Gets and sets the column offset in the range. ',
137 format => '',
138 read_only => '',
139 },
140 'filter_type' => {
141 datatype => 'string',
142 base_name => 'FilterType',
143 description => 'Gets and sets the type fo filtering data. ',
144 format => '',
145 read_only => '',
146 },
147 'multiple_filters' => {
148 datatype => 'MultipleFilters',
149 base_name => 'MultipleFilters',
150 description => 'This class contains a property named "MultipleFilters" of type "MultipleFilters" that can be both read and written.',
151 format => '',
152 read_only => '',
153 },
154 'color_filter' => {
155 datatype => 'ColorFilter',
156 base_name => 'ColorFilter',
157 description => '',
158 format => '',
159 read_only => '',
160 },
161 'custom_filters' => {
162 datatype => 'ARRAY[CustomFilter]',
163 base_name => 'CustomFilters',
164 description => '',
165 format => '',
166 read_only => '',
167 },
168 'dynamic_filter' => {
169 datatype => 'DynamicFilter',
170 base_name => 'DynamicFilter',
171 description => '',
172 format => '',
173 read_only => '',
174 },
175 'icon_filter' => {
176 datatype => 'IconFilter',
177 base_name => 'IconFilter',
178 description => '',
179 format => '',
180 read_only => '',
181 },
182 'top10_filter' => {
183 datatype => 'Top10Filter',
184 base_name => 'Top10Filter',
185 description => '',
186 format => '',
187 read_only => '',
188 },
189 'visibledropdown' => {
190 datatype => 'string',
191 base_name => 'Visibledropdown',
192 description => 'Indicates whether the AutoFilter button for this column is visible. ',
193 format => '',
194 read_only => '',
195 },
196 });
197
198 __PACKAGE__->swagger_types( {
199 'field_index' => 'int',
200 'filter_type' => 'string',
201 'multiple_filters' => 'MultipleFilters',
202 'color_filter' => 'ColorFilter',
203 'custom_filters' => 'ARRAY[CustomFilter]',
204 'dynamic_filter' => 'DynamicFilter',
205 'icon_filter' => 'IconFilter',
206 'top10_filter' => 'Top10Filter',
207 'visibledropdown' => 'string'
208 } );
209
210 __PACKAGE__->attribute_map( {
211 'field_index' => 'FieldIndex',
212 'filter_type' => 'FilterType',
213 'multiple_filters' => 'MultipleFilters',
214 'color_filter' => 'ColorFilter',
215 'custom_filters' => 'CustomFilters',
216 'dynamic_filter' => 'DynamicFilter',
217 'icon_filter' => 'IconFilter',
218 'top10_filter' => 'Top10Filter',
219 'visibledropdown' => 'Visibledropdown'
220 } );
221
222 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
223
224
225 1;