T - a context objectR - a member to be constructed, modified and/or validatedpublic interface Tag<T,R>
A Tag may have child tags of Tag<? super R, ?>.
| Modifier and Type | Method and Description |
|---|---|
void |
close(Object c,
Object r,
String text,
Object cache)
Called by TagHandler.endElement to consume text.
|
default Tag<? super R,?>[] |
getChildren()
Provide no children by default.
|
default Closer<T,R,String,?> |
getCloser()
Override to implement closing behaviour.
|
default EventMatcher |
getElementMatcher()
The default ElementMatcher matches if this tag is "*" or either of the localName or the qName equals this tag.
|
R |
getItem(T t,
OpenEvent openEvent)
Obtains a member R from a context object T.
|
default Opener<T,R,OpenEvent,?> |
getOpener()
Override to implement opening behaviour.
|
String |
getTag() |
default TagModel<? super R> |
getTagModel()
Obtain a new TagModel on the children or return
null
if there are no children. |
default java.util.function.BiConsumer<Tag<T,R>,R> |
getValidator()
Override to implement validation behaviour.
|
default boolean |
isChoice()
True if this Tag's children are choices (otherwise they're a sequence).
|
default boolean |
isJump()
True if this Tag aliases another Tag.
|
default boolean |
isMultiple()
True if this Tag is can be repeated.
|
default boolean |
isOptional()
True if this Tag is optional, and can be skipped if encountered unmatched.
|
default boolean |
isStep()
True if this Tag steps to another Tag (as implemented by getItem(context, event)).
|
default boolean |
matches(OpenEvent openEvent)
True if this Tag matches the supplied open element arguments.
|
String |
name() |
Object |
open(Object c,
Object r,
OpenEvent event)
Called by TagHandler.startElement to consume attributes.
|
static <X> Tag<? super X,?>[] |
tags(Tag<? super X,?>... tags)
Utility method to cast an argument list of Tags as an array.
|
@SafeVarargs static <X> Tag<? super X,?>[] tags(Tag<? super X,?>... tags)
X - a derived super typetags - an argument list of TagsString getTag()
String name()
R getItem(T t, OpenEvent openEvent)
NB: A FlatTag provides itself as the member.
t - a context objectopenEvent - details of the eventObject open(Object c, Object r, OpenEvent event)
c - the context objectr - the object in contextevent - details of the eventvoid close(Object c, Object r, String text, Object cache)
c - the context objectr - the object in contexttext - the text read whilst opencache - any object cached by the openerdefault TagModel<? super R> getTagModel()
null
if there are no children.default boolean matches(OpenEvent openEvent)
Delegates to the assigned ElementMatcher.
openEvent - an OpenEventdefault boolean isChoice()
default boolean isOptional()
default boolean isMultiple()
default boolean isStep()
default boolean isJump()
default EventMatcher getElementMatcher()
default Opener<T,R,OpenEvent,?> getOpener()
default Closer<T,R,String,?> getCloser()
default java.util.function.BiConsumer<Tag<T,R>,R> getValidator()
Copyright © 2021. All rights reserved.