comparison Lib/IMPL/Class/Property/Accessor.pm @ 60:b0c068da93ac

Lazy activation for the configuration objects (final concept) small fixes
author wizard
date Tue, 09 Mar 2010 19:47:39 +0300
parents
children 76515373dac0
comparison
equal deleted inserted replaced
59:0f3e369553bd 60:b0c068da93ac
1 package IMPL::Class::Property::Accessor;
2 use strict;
3 use base qw(IMPL::Class::Property::Base);
4
5 sub factoryParams {
6 $_[0]->SUPER::factoryParams, qw($field);
7 }
8
9 sub RemapFactoryParams {
10 my ($self,$propInfo) = @_;
11
12 return $self->SUPER::RemapFactoryParams($propInfo),$propInfo->Name;
13 }
14
15 sub GenerateGet {
16 'return $this->get($field);';
17 }
18
19 sub GenerateSet {
20 'return $this->set($field,@_);';
21 }
22
23 sub GenerateSetList {
24 'my $val = IMPL::Object::List->new( (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] );
25 $this->set($field,$val);
26 return( wantarray ? @{ $val } : $val );';
27 }
28
29 sub GenerateGetList {
30 'my $val = $this->get($field);
31 $this->set($field,$val = IMPL::Object::List->new()) unless $val;
32 return( wantarray ? @{ $val } : $val );';
33 }
34
35 1;