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> AassertAttrsComplete(TdomAttributeMissingSupplier<? extends A> source) Wrapper for a tdom element constructor invocation when the author knows that all#REQUIREDattributes are provided.get()
-
Method Details
-
get
- Throws:
TdomAttributeMissingException
-
assertAttrsComplete
Wrapper for a tdom element constructor invocation when the author knows that all#REQUIREDattributes are provided. The typical usage pattern is to catchTdomAttributeMissingExceptions 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_xis 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.)
- Parameters:
source- a supplier, mostly a lambda-wrapper()->new E(..)round a constructor invocation- Throws:
AssertionError- if aTdomAttributeMissingExceptionis caught
-