comparison Lib/IMPL/Class/Property.pm @ 278:4ddb27ff4a0b

core refactoring
author cin
date Mon, 04 Feb 2013 02:10:37 +0400
parents 8a5da17d7ef9
children
comparison
equal deleted inserted replaced
277:6585464c4664 278:4ddb27ff4a0b
7 } 7 }
8 8
9 use IMPL::lang qw(:hash); 9 use IMPL::lang qw(:hash);
10 use IMPL::Const qw(:prop); 10 use IMPL::Const qw(:prop);
11 use Carp qw(carp); 11 use Carp qw(carp);
12 require IMPL::Class::Memeber; 12 require IMPL::Class::Member;
13 13
14 sub import { 14 sub import {
15 __PACKAGE__->export_to_level(1,@_); 15 __PACKAGE__->export_to_level(1,@_);
16 IMPL::Class::Member->export_to_level(1,@_); 16 IMPL::Class::Member->export_to_level(1,@_);
17 } 17 }
24 sub prop_list { 4 }; 24 sub prop_list { 4 };
25 25
26 sub property($$) { 26 sub property($$) {
27 my ($propName,$attributes) = @_; 27 my ($propName,$attributes) = @_;
28 28
29 $attributes = { 29 my $class = caller;
30 get => $attributes & PROP_GET, 30
31 set => $attributes & PROP_SET,
32 isList => $attributes & PROP_LIST
33 } unless ref $attributes;
34
35 return hashMerge ( 31 return hashMerge (
36 $attributes, 32 $class->ClassPropertyImplementor->NormalizeSpecification($attributes),
37 { 33 {
38 -implementor => 'ImplementProperty', 34 implementor => $class->ClassPropertyImplementor,
39 name => $propName, 35 name => $propName,
40 class => scalar(caller), 36 class => scalar(caller),
41 } 37 }
42 ); 38 );
43 } 39 }
44 40
45 sub CreateProperty { 41 sub CreateProperty {
46 my ($class,$propName,$attributes) = @_; 42 my ($class,$propName,@attributes) = @_;
47 43
48 carp "Using create property is deprecated, use ImplementProperty instead"; 44 $class
49 45 ->ClassPropertyImplementor
50 $class->ImplementProperty($propName,$attributes); 46 ->Implement(
47 @attributes,
48 {
49 name => $propName,
50 class => $class,
51 }
52 );
51 }; 53 };
52 54
53 1; 55 1;