API change to allow to detect missing attribute binding
The way we build this attribute binding, there is no single entity to handle all attribute bindings. Thus the only way to detect a missing binding is when none of the binding layers was able to handle a given INS verb
This commit is contained in:
parent
6382cac830
commit
201b6542f2
6 changed files with 44 additions and 20 deletions
|
|
@ -402,11 +402,11 @@ namespace diff{
|
|||
* that a new child element is
|
||||
* being inserted at current position
|
||||
*/
|
||||
virtual void
|
||||
virtual bool
|
||||
injectNew (GenNode const& n) override
|
||||
{
|
||||
target_.inject (GenNode{n}, "injectNew");
|
||||
PAR::injectNew (n);
|
||||
return PAR::injectNew (n);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
|
|
|
|||
|
|
@ -141,18 +141,15 @@
|
|||
* present in the class definition underlying this binding. In such
|
||||
* a case, we just assign the given value. This implementation leeway
|
||||
* is deliberate to support classes with optional / defaultable properties.
|
||||
* @throw error::Invalid on attempt to insert an unknown attribute / field.
|
||||
*/
|
||||
virtual void
|
||||
virtual bool
|
||||
injectNew (GenNode const& spec) override
|
||||
{
|
||||
if (not isApplicable(spec))
|
||||
PAR::injectNew(spec); ////////////////////////////////////////TODO change interface, so we can find out if anyone was able to handle this request. This allows us then to throw otherwise
|
||||
else
|
||||
{
|
||||
change_(spec.data.get<ValueType>());
|
||||
// return true;
|
||||
}
|
||||
return PAR::injectNew(spec);
|
||||
|
||||
change_(spec.data.get<ValueType>());
|
||||
return true;
|
||||
}
|
||||
|
||||
/** has no meaning, since object fields have no notion of "order".
|
||||
|
|
@ -195,11 +192,9 @@
|
|||
{
|
||||
if (not isApplicable(spec))
|
||||
return PAR::assignElm(spec);
|
||||
else
|
||||
{
|
||||
change_(spec.data.get<ValueType>());
|
||||
return true;
|
||||
}
|
||||
|
||||
change_(spec.data.get<ValueType>());
|
||||
return true;
|
||||
}
|
||||
|
||||
/** locate the designated target element and build a suitable
|
||||
|
|
|
|||
|
|
@ -218,10 +218,11 @@
|
|||
* and insert it at current position
|
||||
* into the target sequence.
|
||||
*/
|
||||
virtual void
|
||||
virtual bool
|
||||
injectNew (GenNode const& n) override
|
||||
{
|
||||
binding_.inject (binding_.construct(n));
|
||||
return true; /////////////////////////////////////////////////////////TODO with all these operations: need to invoke selector and possibly delegate to parent....
|
||||
}
|
||||
|
||||
virtual bool
|
||||
|
|
|
|||
|
|
@ -214,11 +214,13 @@ namespace diff{
|
|||
// do nothing by default
|
||||
}
|
||||
|
||||
/** establish new element at current position */
|
||||
virtual void
|
||||
/** establish new element at current position
|
||||
* @return `true` when successfully inserted something */
|
||||
virtual bool
|
||||
injectNew (GenNode const&)
|
||||
{
|
||||
// do nothing by default
|
||||
return false;
|
||||
}
|
||||
|
||||
/** ensure the next source element matches with given spec */
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ namespace diff{
|
|||
namespace test{
|
||||
|
||||
using lumiera::error::LUMIERA_ERROR_LOGIC;
|
||||
using lumiera::error::LUMIERA_ERROR_INVALID;
|
||||
|
||||
|
||||
namespace {//Test fixture....
|
||||
|
|
@ -726,7 +725,7 @@ namespace test{
|
|||
CHECK (-1 == beta);
|
||||
CHECK (3.45 == gamma);
|
||||
|
||||
VERIFY_ERROR (INVALID, mutator1.injectNew (ATTRIB2)); // ...because we didn't define a binding for ATTRIB2 (aka "beta")
|
||||
CHECK (not mutator1.injectNew (ATTRIB2)); // ...because we didn't define a binding for ATTRIB2 (aka "beta")
|
||||
|
||||
// any changes to something other than attributes are just delegated to the next "onion layer"
|
||||
// since in this case here, there is only one layer (our attribute binding), these other changes will be silently ignored
|
||||
|
|
|
|||
|
|
@ -3967,6 +3967,33 @@
|
|||
</node>
|
||||
</node>
|
||||
<node CREATED="1464227227610" ID="ID_392179794" MODIFIED="1464227235981" TEXT="aber: alle Primitive durchimplementieren"/>
|
||||
<node CREATED="1464386998240" ID="ID_1575821815" MODIFIED="1464387002771" TEXT="key: EntryID"/>
|
||||
<node CREATED="1464387004423" ID="ID_1076928743" MODIFIED="1464387014329" TEXT="Fehlerbehandlung">
|
||||
<node CREATED="1464387034539" ID="ID_1580200225" MODIFIED="1464387037718" TEXT="injectNew">
|
||||
<node CREATED="1464387043146" ID="ID_1075443725" MODIFIED="1464387046181" TEXT="API erweitern"/>
|
||||
<node CREATED="1464387046769" ID="ID_1282279036" MODIFIED="1464387053620" TEXT="Rückgabewert"/>
|
||||
<node CREATED="1464387055632" ID="ID_381742708" MODIFIED="1464387058851" TEXT="andere Layer fragen"/>
|
||||
</node>
|
||||
<node CREATED="1464387071669" ID="ID_1152000090" MODIFIED="1464387151131" TEXT="skip">
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1464387092091" ID="ID_534085817" MODIFIED="1464387095959" TEXT="hat kein Argument"/>
|
||||
<node CREATED="1464387096498" ID="ID_1113073682" MODIFIED="1464387158085" TEXT="kann daher Selektor nicht ausführen">
|
||||
<icon BUILTIN="smily_bad"/>
|
||||
</node>
|
||||
<node CREATED="1464387102850" ID="ID_1022478410" MODIFIED="1464387148396" TEXT="Fehlererkennung nicht möglich">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1464386771270" ID="ID_1279882649" MODIFIED="1464386811412" TEXT="setter vs mutator">
|
||||
<node CREATED="1464386870265" ID="ID_1326576761" MODIFIED="1464387168773" TEXT="Metaprogrammierung"/>
|
||||
<node CREATED="1464386878983" ID="ID_19052291" MODIFIED="1464386887354" TEXT="Code selber muß es implizit wissen"/>
|
||||
<node CREATED="1464386904676" ID="ID_1844234642" MODIFIED="1464386908705" TEXT="entweder-oder">
|
||||
<icon BUILTIN="help"/>
|
||||
<node CREATED="1464386910099" ID="ID_127180278" MODIFIED="1464386913750" TEXT="nicht notwendig"/>
|
||||
<node CREATED="1464386929745" ID="ID_1833671444" MODIFIED="1464386936708" TEXT="es greift der Layer, der es kann"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1457232746179" ID="ID_1793680066" MODIFIED="1464227326650" TEXT="Rec<GenNode>" VSHIFT="11">
|
||||
|
|
|
|||
Loading…
Reference in a new issue