0
|
1 package IMPL::Class::PropertyInfo;
|
|
2 use strict;
|
|
3
|
|
4 use base qw(IMPL::Class::MemberInfo);
|
|
5
|
|
6 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet));
|
|
7 __PACKAGE__->PassThroughArgs;
|
|
8
|
|
9 our @Implementors = ( ['IMPL::Object' => 'IMPL::Class::Property::Direct'] );
|
|
10
|
|
11 my %LoadedModules;
|
|
12
|
|
13 sub CTOR {
|
|
14 my $this = shift;
|
|
15
|
|
16 my $implementor = $this->Implementor($this->SelectImplementor());
|
|
17 if (my $class = ref $implementor ? undef : $implementor) {
|
|
18 if (not $LoadedModules{$class}) {
|
|
19 (my $package = $class.'.pm') =~ s/::/\//g;
|
|
20 require $package;
|
|
21 $LoadedModules{$class} = 1;
|
|
22 }
|
|
23 }
|
|
24
|
|
25 $this->Mutators(0) unless defined $this->Mutators;
|
|
26 }
|
|
27
|
|
28 sub SelectImplementor {
|
|
29 my ($this) = @_;
|
|
30
|
|
31 foreach my $item (@Implementors) {
|
|
32 return $item->[1] if $this->Class->isa($item->[0]);
|
|
33 }
|
|
34
|
|
35 die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class);
|
|
36 }
|
|
37
|
|
38 1;
|