Package eu.bandm.tools.tdom.runtime
Interface TdomAttributeMissingSupplier<A>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Intended to match tdom element constructor calls as arguments for
exception handler strategies.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> A
assertAttrsComplete
(TdomAttributeMissingSupplier<? extends A> source) Wrapper for a tdom element constructor invocation when the author knows that all#REQUIRED
attributes are provided.get()
-
Method Details
-
get
- Throws:
TdomAttributeMissingException
-
assertAttrsComplete
Wrapper for a tdom element constructor invocation when the author knows that all#REQUIRED
attributes are provided. The typical usage pattern is to catchTdomAttributeMissingException
s in the middle of a deep nested constructor invocation, which often arises in functional bottom-up programming style. Example:new Element_a (... , assertAttrsComplete(()->new Element_b(){ initAttrs(){ assertAttrSetValid(getAttr_x(), "y"); }}), ...)
This example requires thatAttr_x
is the only required attribute inElement_b
. Since it is required, its.setValue(..)
function always throws an AttributeSyntaxException, since null is not allowed.(FIXME differenzierung zwischen TdomAttributeSyntaxException und TdomAttributeNullException gips noch nicht.)
- Throws:
source
- a supplier, mostly a lambda-wrapper()->new E(..)
round a constructor invocationAssertionError
- if aTdomAttributeMissingException
is caught
-