annotate Lib/IMPL/ORM/Schema/Field.pm @ 28:6d33f75c6e1f

ORM in works
author Sergey
date Mon, 19 Oct 2009 04:13:54 +0400
parents
children d660fb38b7cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
1 package IMPL::ORM::Schema::Field;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
2 use strict;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
3 use warnings;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
4
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
5 use base qw(IMPL::DOM::Node);
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
7
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
8 BEGIN {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
9 public property fieldName => prop_get | owner_set;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
10 public property fieldType => prop_get | owner_set;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
11 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
12
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
13 our %CTOR = (
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
14 'IMPL::DOM::Node' => sub { nodeName => 'Field' }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
15 );
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
16
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
17 sub CTOR {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
18 my ($this,$name,$type) = @_;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
19
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
20 $this->fieldName($name) or die new IMPL::InvalidArgumentException('A name is required for the field');
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
21 $this->fieldType($type) or die new IMPL::InvalidArgumentException('A type is required for the field');
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
22 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
23
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
24 sub canHaveChildren {
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
25 0;
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
26 }
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
27
6d33f75c6e1f ORM in works
Sergey
parents:
diff changeset
28 1;