comparison Lib/IMPL/Object.pm @ 276:8a5da17d7ef9

*IMPL::Class refactoring property definition mechanism (incomplete).
author sergey
date Thu, 31 Jan 2013 17:37:44 +0400
parents 6d8092d8ce1b
children 4ddb27ff4a0b
comparison
equal deleted inserted replaced
275:6253872024a4 276:8a5da17d7ef9
1 package IMPL::Object; 1 package IMPL::Object;
2 use strict; 2 use strict;
3 3
4 use parent qw(IMPL::Object::Abstract); 4 use parent qw(IMPL::Object::Abstract);
5 require IMPL::Class::Property::Direct; 5 require IMPL::Class::Property::Direct;
6 use IMPL::Const qw(:prop);
6 7
7 sub surrogate { 8 sub surrogate {
8 bless {}, ref $_[0] || $_[0]; 9 bless {}, ref $_[0] || $_[0];
9 } 10 }
10
11 __PACKAGE__->static_accessor( propertyInfoClass => 'IMPL::Class::DirectPropertyInfo' );
12 11
13 sub new { 12 sub new {
14 my $class = shift; 13 my $class = shift;
15 my $self = bless {}, ref($class) || $class; 14 my $self = bless {}, ref($class) || $class;
16 $self->callCTOR(@_); 15 $self->callCTOR(@_);
18 $self; 17 $self;
19 } 18 }
20 19
21 sub _PropertyImplementor { 20 sub _PropertyImplementor {
22 'IMPL::Class::Property::Direct' 21 'IMPL::Class::Property::Direct'
22 }
23
24 sub ImplementProperty {
25 my ($self,$name,$attributes) = @_;
26
27 $attributes = {
28 get => $attributes & PROP_GET,
29 set => $attributes & PROP_SET,
30 isList => $attributes & PROP_LIST
31 } unless ref $attributes;
32
33 $self->_ProppertyImplementor->Implement($name,$attributes);
23 } 34 }
24 35
25 1; 36 1;
26 37
27 __END__ 38 __END__