annotate lib/IMPL/Class/MemberInfo.pm @ 408:5c80e33f1218 ref20150831

added 'coarsen' function
author cin
date Mon, 07 Sep 2015 01:35:25 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Class::MemberInfo;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4 use IMPL::Const qw(:prop);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 BEGIN {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 our @ISA = qw(IMPL::Object::Accessor);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 require IMPL::Object::Accessor;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 require IMPL::Exception;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 # использовать ClassPropertyImplementor не получится, поскольку он будет
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 # создавать экземпляры PropertyInfo, который не доописан (в нем не определены
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 # члены)
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 __PACKAGE__->mk_accessors(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 qw(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 name
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 access
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 class
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 attributes
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 )
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 our %CTOR = (
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 'IMPL::Object::Accessor' => undef
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 sub CTOR {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29 my $this = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
31 die new IMPL::Exception('The name is required for the member') unless $this->name;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32 die new IMPL::Exception('The class is required for the member') unless $this->class;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
34 $this->attributes({}) unless defined $this->attributes;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
35 $this->access(3) unless $this->access;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
37
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 1;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
39
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
40 __END__
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
41
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
42 =pod
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
43
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
44 =head1 NAME
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
45
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
46 C<IMPL::Class::MemberInfo> - информация о члене класса.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
47
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
48 =head1 DESCRIPTION
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
49
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
50 Данный класс является базовым для таких классов как C<IMPL::Class::PropertyInfo>, C<IMPL::Class::MethodInfo> и
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
51 предназначен для хренения метаданных.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
52
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
53 Данный класс наследуется от C<IMPL::Object::Accessor> и не содержит в себе метаданных о своих членах.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
54
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
55 =head1 MEMBERS
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
56
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
57 =over
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
58
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
59 =item C<[get,set] name>
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
60
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
61 Имя члена.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
62
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
63 =item C<[get,set] access>
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
64
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
65 Default public.
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
66
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
67 Атрибут доступа ( public | private | protected )
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
68
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
69 =item C<[get,set] class>
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
70
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
71 Класс владелец
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
72
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
73 =item C<[get,set] attributes>
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
74
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
75 Дополнительные атрибуты
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
76
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
77 =item C<Implement()>
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
78
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
79 При реализации собственного субкласса, данный метод может быть переопределен для
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
80 реализации дополнительной обработки (например, создание методов доступа для свойств).
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
81
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
82 =back
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
83
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
84 =cut