view Lib/IMPL/Class/Property/Accessor.pm @ 122:a7efb3117295

Fixed bug in IMPL::DOM::Navigator::selectNodes Fixed bug in IMPL::DOM::Node::selectNodes renamed operator 'type' to 'typeof' in IMPL::Object::Abstract A proper implementation of the IMPL::DOM::Node::nodeProperty and a related changes in the IMPL::DOM::Property module, now the last is very simple.
author wizard
date Tue, 08 Jun 2010 20:12:45 +0400
parents b0c068da93ac
children 76515373dac0
line wrap: on
line source

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;