annotate Lib/IMPL/DOM/Schema/SimpleNode.pm @ 119:8114aaa7feba

Json format
author wizard
date Mon, 07 Jun 2010 17:43:15 +0400
parents 196bf443b5e1
children e30bdd040fe3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
1 package IMPL::DOM::Schema::SimpleNode;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
5 use base qw(IMPL::DOM::Schema::Node);
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
6 use IMPL::Class::Property;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
7 use IMPL::Class::Property::Direct;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
8
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
9 BEGIN {
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
10 public _direct property inflator => prop_get;
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
11 public _direct property messageInflateError => prop_get;
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
12 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
13
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
14 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
15 'IMPL::DOM::Schema::Node' => sub {my %args = @_; $args{nodeName} ||= 'SimpleNode'; %args}
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
16 );
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
17
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
18 sub CTOR {
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
19 my ($this,%args) = @_;
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
20
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
21 $this->{$inflator} = $args{inflator} if $args{inflator};
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
22 $this->{$messageInflateError} = $args{messageInflateError} || 'Failed to inflate nodeValue %Node.path%: %Error%';
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
23 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
24
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
25 sub Validate {
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
26 my ($this,$node,$ctx) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
27
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
28 my @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
29
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
30 push @result, $_->Validate($node,$ctx) foreach $this->childNodes;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
31
104
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
32 return @result;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
33 }
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
34
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
35 sub inflateValue {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
36 my ($this,$value) = @_;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
37
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
38 if ( my $inflator = $this->inflator ) {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
39 return $inflator->new($value);
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
40 } else {
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
41 return $value;
196bf443b5e1 DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents: 103
diff changeset
42 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
43 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
45 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
46
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
47 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
48
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
49 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
50
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
51 =head1 NAME
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
52
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
53 C<IMPL::DOM::SimpleNode> - узел с текстом.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
54
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
55 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
56
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
57 Узел имеющий простое значение. Данный узел может содержать ограничения
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
58 на простое значение.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
59
103
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
60 Производит валидацию содержимого, при постоении DOM модели не имеет специального
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
61 типа и будет создан в виде C<IMPL::DOM::Node>.
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
62
c289ed9662ca Schema beta 2
wizard
parents: 49
diff changeset
63 Также определяет как будет воссоздано значение узла в DOM модели.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
64
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 20
diff changeset
65 =cut