diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/Class/Property/Accessor.pm	Tue Mar 09 19:47:39 2010 +0300
@@ -0,0 +1,35 @@
+package IMPL::Class::Property::Accessor;
+use strict;
+use base qw(IMPL::Class::Property::Base);
+
+sub factoryParams {
+	$_[0]->SUPER::factoryParams, qw($field);
+}
+
+sub RemapFactoryParams {
+	my ($self,$propInfo) = @_;
+	
+	return $self->SUPER::RemapFactoryParams($propInfo),$propInfo->Name;
+}
+
+sub GenerateGet {
+	'return $this->get($field);';
+}
+
+sub GenerateSet {
+	'return $this->set($field,@_);';
+}
+
+sub GenerateSetList {
+	'my $val = IMPL::Object::List->new( (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] );
+	$this->set($field,$val);	
+	return(	wantarray ?	@{ $val } : $val );';
+}
+
+sub GenerateGetList {
+	'my $val = $this->get($field);
+	$this->set($field,$val = IMPL::Object::List->new()) unless $val;
+	return(	wantarray ?	@{ $val	} : $val );';
+}
+
+1;
\ No newline at end of file