Mercurial > pub > Impl
comparison Lib/IMPL/Code/BasePropertyImplementor.pm @ 278:4ddb27ff4a0b
core refactoring
author | cin |
---|---|
date | Mon, 04 Feb 2013 02:10:37 +0400 |
parents | 6585464c4664 |
children | ced5937ff21a |
comparison
equal
deleted
inserted
replaced
277:6585464c4664 | 278:4ddb27ff4a0b |
---|---|
43 ? $spec | 43 ? $spec |
44 : { | 44 : { |
45 get => $spec & PROP_GET, | 45 get => $spec & PROP_GET, |
46 set => $spec & PROP_SET, | 46 set => $spec & PROP_SET, |
47 isList => $spec & PROP_LIST, | 47 isList => $spec & PROP_LIST, |
48 ownerSet => $spec & PROP_OWNERSET | 48 ownerSet => (($spec & PROP_OWNERSET) == PROP_OWNERSET), |
49 direct => $spec & PROP_DIRECT | |
49 }; | 50 }; |
50 } | 51 } |
51 | 52 |
52 sub CreateFactoryId { | 53 sub CreateFactoryId { |
53 my ($self, $spec) = @_; | 54 my ($self, $spec) = @_; |
54 | 55 |
55 join( '', | 56 join( '', |
56 map( | 57 map( |
57 $_ | 58 ($_ |
58 ? ref $_ eq 'CODE' | 59 ? (ref $_ eq 'CODE' |
59 ? 'x' | 60 ? 'x' |
60 : 's' | 61 : 's') |
61 : '_', | 62 : '_'), |
62 @$spec{qw(get set)} | 63 @$spec{qw(get set)} |
63 ), | 64 ), |
64 $spec->{access}, | 65 $spec->{access} || ACCESS_PUBLIC, |
65 $spec->{validator} ? 'v' : '_', | 66 $spec->{validator} ? 'v' : '_', |
66 $spec->{isList} ? 'l' : '_', | 67 $spec->{isList} ? 'l' : '_', |
67 $spec->{ownerSet} ? 'o' : '_' | 68 $spec->{ownerSet} ? 'o' : '_' |
68 ); | 69 ); |
69 } | 70 } |
70 | 71 |
71 sub CreateFactory { | 72 sub CreateFactory { |
72 my ($self,$spec) = @_; | 73 my ($self,$spec) = @_; |
73 | 74 |
74 return $self->CreateFactoryImpl( | 75 return $self->CreateFactoryImpl( |
75 $spec->{get} | 76 ($spec->{get} |
76 ? ref $spec->{get} eq 'CODE' | 77 ? (ref $spec->{get} eq 'CODE' |
77 ? $self->CodeCustomGetAccessor | 78 ? $self->CodeCustomGetAccessor |
78 : $spec->{isList} | 79 : ($spec->{isList} |
79 ? $spec->CodeGetListAccessor | 80 ? $self->CodeGetListAccessor |
80 : $spec->CodeGetAccessor | 81 : $self->CodeGetAccessor |
81 : $spec->CodeNoGetAccessor, | 82 ) |
82 $spec->{set} | 83 ) |
83 ? ref $spec->{set} eq 'CODE' | 84 : $self->CodeNoGetAccessor |
85 ), | |
86 ($spec->{set} | |
87 ? (ref $spec->{set} eq 'CODE' | |
84 ? $self->CodeCustomSetAccessor | 88 ? $self->CodeCustomSetAccessor |
85 : $spec->{isList} | 89 : ($spec->{isList} |
86 ? $spec->CodeSetListAccessor | 90 ? $self->CodeSetListAccessor |
87 : $spec->CodeSetAccessor | 91 : $self->CodeSetAccessor |
88 : $spec->CodeNoSetAccessor, | 92 ) |
93 ) | |
94 : $self->CodeNoSetAccessor | |
95 ), | |
89 $ACCESS_CODE{$spec->{access} || ACCESS_PUBLIC} || '', | 96 $ACCESS_CODE{$spec->{access} || ACCESS_PUBLIC} || '', |
90 $spec->{validator} ? $self->CodeValidator : '', | 97 $spec->{validator} ? $self->CodeValidator : '', |
91 $spec->{ownerSet} ? $self->CodeOwnerCheck : '' | 98 $spec->{ownerSet} ? $self->CodeOwnerCheck : '' |
92 ); | 99 ); |
93 } | 100 } |