Commit | Line | Data |
7adfd53f |
1 | package Reaction::Meta::InterfaceModel::Object::Class; |
2 | |
3 | use aliased 'Reaction::Meta::InterfaceModel::Object::ParameterAttribute'; |
4 | use aliased 'Reaction::Meta::InterfaceModel::Object::DomainModelAttribute'; |
5 | |
6 | use Reaction::Class; |
7 | |
81393881 |
8 | use namespace::clean -except => [ qw(meta) ]; |
9 | extends 'Reaction::Meta::Class'; |
7adfd53f |
10 | |
81393881 |
11 | around initialize => sub { |
12 | my $super = shift; |
13 | my $class = shift; |
14 | my $pkg = shift; |
15 | $super->($class, $pkg, attribute_metaclass => ParameterAttribute, @_); |
16 | }; |
17 | sub add_domain_model { |
18 | my $self = shift; |
19 | my $name = shift; |
20 | $self->add_attribute($name, metaclass => DomainModelAttribute, @_); |
21 | }; |
22 | sub parameter_attributes { |
23 | my $self = shift; |
24 | return grep { $_->isa(ParameterAttribute) } |
4d0bacd2 |
25 | $self->get_all_attributes; |
7adfd53f |
26 | }; |
81393881 |
27 | sub domain_models { |
28 | my $self = shift; |
29 | return grep { $_->isa(DomainModelAttribute) } |
4d0bacd2 |
30 | $self->get_all_attributes; |
81393881 |
31 | }; |
32 | |
83529ec1 |
33 | __PACKAGE__->meta->make_immutable(inline_constructor => 0); |
81393881 |
34 | |
7adfd53f |
35 | |
36 | 1; |
37 | |
38 | =head1 NAME |
39 | |
40 | Reaction::Meta::InterfaceModel::Object::Class |
41 | |
42 | =head1 DESCRIPTION |
43 | |
44 | =head1 METHODS |
45 | |
46 | =head2 add_domain_model |
47 | |
48 | =head2 domain_models |
49 | |
50 | =head2 parameter_attributes |
51 | |
52 | =head1 AUTHORS |
53 | |
54 | See L<Reaction::Class> for authors. |
55 | |
56 | =head1 LICENSE |
57 | |
58 | See L<Reaction::Class> for the license. |
59 | |
60 | =cut |