AsposeCellsCloud-CellsApi

 view release on metacpan or  search on metacpan

lib/AsposeCellsCloud/Object/Legend.pm  view on Meta::CPAN

	return $self;
}  

# return perl hash
sub to_hash {
    return decode_json(JSON->new->convert_blessed->encode( shift ));
}

# used by JSON for serialization
sub TO_JSON { 
    my $self = shift;
    my $_data = {};
    foreach my $_key (keys %{$self->attribute_map}) {
        if (defined $self->{$_key}) {
            $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
        }
    }
    return $_data;
}

# from Perl hashref
sub from_hash {
    my ($self, $hash) = @_;

    # loop through attributes and use swagger_types to deserialize the data
    while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
    	my $_json_attribute = $self->attribute_map->{$_key}; 
        if ($_type =~ /^array\[/i) { # array
            my $_subclass = substr($_type, 6, -1);
            my @_array = ();
            foreach my $_element (@{$hash->{$_json_attribute}}) {
                push @_array, $self->_deserialize($_subclass, $_element);
            }
            $self->{$_key} = \@_array;
        } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
            $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
        } else {
        	$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
        }
    }

    return $self;
}

# deserialize non-array data
sub _deserialize {
    my ($self, $type, $data) = @_;
    $log->debugf("deserializing %s with %s",Dumper($data), $type);

    if ($type eq 'DateTime') {
        return DateTime->from_epoch(epoch => str2time($data));
    } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
        return $data;
    } else { # hash(model)
        my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
        return $_instance->from_hash($data);
    }
}


__PACKAGE__->class_documentation({description => 'Encapsulates the object that represents the chart legend.',
                                  class => 'Legend',
                                  required => [], # TODO
}                                 );


__PACKAGE__->method_documentation({
     'position' => {
     	datatype => 'string',
     	base_name => 'Position',
     	description => 'Gets or sets the legend position type.',
     	format => '',
     	read_only => '',
     		},
     'legend_entries' => {
     	datatype => 'LinkElement',
     	base_name => 'LegendEntries',
     	description => 'Gets a collection of all the LegendEntry objects in the specified chart legend.                        Setting the legend entries of the surface chart is not supported.                        So it will return null if the chart ...
     	format => '',
     	read_only => '',
     		},
     'area' => {
     	datatype => 'Area',
     	base_name => 'Area',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'auto_scale_font' => {
     	datatype => 'boolean',
     	base_name => 'AutoScaleFont',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'background_mode' => {
     	datatype => 'string',
     	base_name => 'BackgroundMode',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'border' => {
     	datatype => 'Line',
     	base_name => 'Border',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'font' => {
     	datatype => 'Font',
     	base_name => 'Font',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'is_automatic_size' => {
     	datatype => 'boolean',
     	base_name => 'IsAutomaticSize',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'is_inner_mode' => {
     	datatype => 'boolean',
     	base_name => 'IsInnerMode',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'shadow' => {
     	datatype => 'boolean',
     	base_name => 'Shadow',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'width' => {
     	datatype => 'int',
     	base_name => 'Width',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'height' => {
     	datatype => 'int',
     	base_name => 'Height',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'x' => {
     	datatype => 'int',
     	base_name => 'X',
     	description => '',
     	format => '',
     	read_only => '',
     		},
     'y' => {
     	datatype => 'int',
     	base_name => 'Y',
     	description => '',
     	format => '',
     	read_only => '',
     		},    
});

__PACKAGE__->swagger_types( {
    'position' => 'string',
    'legend_entries' => 'LinkElement',
    'area' => 'Area',
    'auto_scale_font' => 'boolean',
    'background_mode' => 'string',
    'border' => 'Line',
    'font' => 'Font',
    'is_automatic_size' => 'boolean',
    'is_inner_mode' => 'boolean',
    'shadow' => 'boolean',
    'width' => 'int',
    'height' => 'int',
    'x' => 'int',
    'y' => 'int' 
} );

__PACKAGE__->attribute_map( {
    'position' => 'Position',
    'legend_entries' => 'LegendEntries',
    'area' => 'Area',
    'auto_scale_font' => 'AutoScaleFont',
    'background_mode' => 'BackgroundMode',
    'border' => 'Border',
    'font' => 'Font',
    'is_automatic_size' => 'IsAutomaticSize',
    'is_inner_mode' => 'IsInnerMode',
    'shadow' => 'Shadow',
    'width' => 'Width',
    'height' => 'Height',
    'x' => 'X',
    'y' => 'Y' 
} );

__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});


1;



( run in 0.651 second using v1.01-cache-2.11-cpan-9581c071862 )