annotate Lib/IMPL/Class/PropertyInfo.pm @ 276:8a5da17d7ef9

*IMPL::Class refactoring property definition mechanism (incomplete).
author sergey
date Thu, 31 Jan 2013 17:37:44 +0400
parents 6253872024a4
children 4ddb27ff4a0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
1 package IMPL::Class::PropertyInfo;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
3
228
431db7034a88 Для синхронизации
andrei <andrei@nap21.upri>
parents: 209
diff changeset
4 use parent qw(IMPL::Class::MemberInfo);
431db7034a88 Для синхронизации
andrei <andrei@nap21.upri>
parents: 209
diff changeset
5
431db7034a88 Для синхронизации
andrei <andrei@nap21.upri>
parents: 209
diff changeset
6 our %CTOR = ( 'IMPL::Class::MemberInfo' => '@_' );
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
7
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
8 __PACKAGE__->mk_accessors(qw(type mutators canGet canSet ownerSet isList));
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
10 my %LoadedModules;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
11
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
12 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
13 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
14
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
15 if ( my $type = $this->attributes ? delete $this->attributes->{type} : undef ) {
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
16 $this->type($type);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
17 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
18
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
19 $this->mutators(0) unless defined $this->mutators;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
20 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
21
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
22 sub implementor {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
23 my $this = shift;
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
24
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
25 if (@_) {
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
26 $this->SUPER::implementor(@_);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
27 } else {
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
28 my $implementor = $this->SUPER::implementor;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
29 return $implementor if $implementor;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
30
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
31 $implementor = $this->SelectImplementor();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
32
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
33 $this->implementor($implementor);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
34 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
35
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
36 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
37
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
38 sub SelectImplementor {
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
39 eval {$_[0]->class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class);
274
8d36073411b1 +Added AutoDispose class
cin
parents: 230
diff changeset
40 }
8d36073411b1 +Added AutoDispose class
cin
parents: 230
diff changeset
41
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
42 1;
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
43
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
44 __END__
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
45
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
46 =pod
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
47
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
48 =head1 NAME
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
49
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
50 C<IMPL::Class::PropertyInfo> - метаданные о свойствах объектов. Используются для отражения и
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
51 проверки данных объектов.
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
52
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
53 =head1 DESCRIPTION
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
54
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
55 В зависимости от типа каждый объект предоставляет способ хранения данных, например хеши позволяют
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
56 хранить состояние в виде ассоциативного массива и т.д. Информация о свойстве предоставляет определенный
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
57 уровень абстракции.
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
58
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
59 =cut