annotate Lib/IMPL/Class/PropertyInfo.pm @ 221:e997e6fbac0b

sync: working on resources schema
author sergey
date Fri, 24 Aug 2012 16:24:14 +0400
parents a8db61d0ed33
children 431db7034a88
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;
163
6ce1f052b90a temp commit
wizard
parents: 134
diff changeset
3 use IMPL::_core::version;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
4
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
5 use IMPL::declare {
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
6 base =>{
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
7 'IMPL::Class::MemberInfo' => '@_'
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
8 }
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
9 };
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
10
60
b0c068da93ac Lazy activation for the configuration objects (final concept)
wizard
parents: 49
diff changeset
11 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet ownerSet));
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
13 my %LoadedModules;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
15 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
16 my $this = shift;
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 if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
19 $this->Type($type);
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
22 $this->Mutators(0) unless defined $this->Mutators;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
23 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
24
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
25 sub Implementor {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
26 my $this = shift;
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
27
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
28 if (@_) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
29 $this->SUPER::Implementor(@_);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
30 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
31 my $implementor = $this->SUPER::Implementor;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
32 return $implementor if $implementor;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
34 $implementor = $this->SelectImplementor();
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 if (my $class = ref $implementor ? undef : $implementor) {
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
37 eval "require $class; 1;" or die $@ unless $LoadedModules{$class}++;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
38 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
39
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
40 $this->Implementor($implementor);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
41 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
43 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
45 sub SelectImplementor {
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
46 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
47 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
48
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
49 1;
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
50
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
51 __END__
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
52
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
53 =pod
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
54
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
55 =head1 NAME
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
56
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
57 C<IMPL::Class::PropertyInfo> - метаданные о свойствах объектов. Используются для отражения и
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
58 проверки данных объектов.
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
59
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
60 =head1 DESCRIPTION
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
61
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
62 В зависимости от типа каждый объект предоставляет способ хранения данных, например хеши позволяют
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
63 хранить состояние в виде ассоциативного массива и т.д. Информация о свойстве предоставляет определенный
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
64 уровень абстракции.
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 180
diff changeset
65
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
66 =cut