diff Lib/IMPL/DOM/Schema/ComplexType.pm @ 388:648dfaf642e0

DOM refactoring, removed inflators from DOM Schema, DOM validation - in progress
author cin
date Tue, 11 Feb 2014 20:22:01 +0400
parents 4ddb27ff4a0b
children 5aff94ba842f
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Schema/ComplexType.pm	Tue Feb 11 01:13:47 2014 +0400
+++ b/Lib/IMPL/DOM/Schema/ComplexType.pm	Tue Feb 11 20:22:01 2014 +0400
@@ -2,26 +2,23 @@
 use strict;
 use warnings;
 
-use parent qw(IMPL::DOM::Schema::ComplexNode);
-use IMPL::Class::Property;
-use IMPL::DOM::Property qw(_dom);
-
-BEGIN {
-    public _dom _direct property nativeType => prop_get;
-    public _dom _direct property messageWrongType => prop_get;
-}
-
-our %CTOR = (
-    'IMPL::DOM::Schema::ComplexNode' => sub {
-        my %args = @_;
-        $args{nodeName} ||= 'ComplexType';
-        $args{minOccur} = 0;
-        $args{maxOccur} = 'unbounded';
-        $args{name} ||= 'ComplexType';
-        delete @args{qw(nativeType messageWrongType)};
-        %args
-    }
-);
+use IMPL::declare {
+	base => [
+		'IMPL::DOM::Schema::ComplexNode' => sub {
+	        my %args = @_;
+	        $args{nodeName} ||= 'ComplexType';
+	        $args{minOccur} = 0;
+	        $args{maxOccur} = 'unbounded';
+	        $args{name} ||= 'ComplexType';
+	        delete @args{qw(nativeType messageWrongType)};
+	        %args
+	    }
+	],
+	props => [
+		nativeType => { get => 1, set => 1, direct => 1, dom => 1 },
+		messageWrongType => { get => 1, set => 1, direct => 1, dom => 1 }
+	]
+};
 
 sub CTOR {
     my ($this,%args) = @_;
@@ -36,11 +33,12 @@
     if ($this->{$nativeType}) {
         return new IMPL::DOM::Schema::ValidationError(
             node => $node,
-            source => $ctx->{Source} || $this,
-            schema => $this,
+            schemaNode => $ctx->{schemaNode} || $this,
+            schemaType => $this,
             message => $this->messageWrongType
         ) unless $node->isa($this->{$nativeType});
     }
+    
     return $this->SUPER::Validate($node,$ctx);
 }