Mercurial > pub > Impl
annotate Lib/IMPL/DOM/Schema/ValidationError.pm @ 118:79cdd6c86409
JSON support (experimental)
author | wizard |
---|---|
date | Mon, 07 Jun 2010 08:21:26 +0400 |
parents | 196bf443b5e1 |
children | a4b0a819bbda |
rev | line source |
---|---|
49 | 1 package IMPL::DOM::Schema::ValidationError; |
2 use strict; | |
3 use warnings; | |
4 | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
5 use overload |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
6 '""' => \&toString, |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
7 'fallback' => 1; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
8 |
49 | 9 use base qw(IMPL::Object); |
10 use IMPL::Class::Property; | |
11 use IMPL::Class::Property::Direct; | |
12 use IMPL::Resources::Format qw(FormatMessage); | |
13 | |
14 BEGIN { | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
15 public _direct property Node => prop_get; # target document node (if exists) |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
16 public _direct property Schema => prop_get; # a schema for the target node (if exists) |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
17 public _direct property Source => prop_get; # a schema which triggered this error (can be equal to the Schema) |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
18 public _direct property Parent => prop_get; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
19 public _direct property Message => prop_get; # displayable message |
49 | 20 } |
21 | |
22 sub CTOR { | |
23 my ($this,%args) = @_; | |
24 | |
100 | 25 $this->{$Node} = $args{Node}; |
49 | 26 $this->{$Schema} = $args{Schema} if $args{Schema}; |
27 $this->{$Source} = $args{Source} if $args{Source}; | |
102 | 28 $this->{$Parent} = $args{Parent} if $args{Parent}; |
49 | 29 $this->{$Message} = FormatMessage(delete $args{Message}, \%args) if $args{Message}; |
30 } | |
31 | |
104
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
32 sub toString { |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
33 (my $this) = @_; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
34 return $this->Message; |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
35 } |
196bf443b5e1
DOM::Schema RC0 inflators support, validation and some other things,
wizard
parents:
102
diff
changeset
|
36 |
49 | 37 1; |