@FunctionalInterface public interface TdomAttributeMissingSupplier<A>
| Modifier and Type | Method and Description |
|---|---|
static <A> A |
assertAttrsComplete(TdomAttributeMissingSupplier<? extends A> source)
Wrapper for a tdom element constructor invocation when the author knows that all
#REQUIRED attributes are provided. |
A |
get() |
A get() throws TdomAttributeMissingException
TdomAttributeMissingExceptionstatic <A> A assertAttrsComplete(TdomAttributeMissingSupplier<? extends A> source)
#REQUIRED attributes are provided.
The typical usage pattern is to catch TdomAttributeMissingExceptions
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 that Attr_x is the only required attribute in
Element_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.)
source - a supplier, mostly a lambda-wrapper ()->new E(..) round a
constructor invocationAssertionError - if a TdomAttributeMissingException is caughtsee also the complete user documentation .