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 o,
String text,
Object cache)
Called by TagHandler.endElement to consume text.
|
static Map<String,String> |
getAttributesMap(Attributes attributes)
Utility method to convert Attributes to a Map.
|
default Tag<? super R,?>[] |
getChildren()
Provide no children by default.
|
default Closer<R,String,?> |
getCloser()
Override to implement closing behaviour.
|
R |
getItem(T t)
Obtains a member R from a context object T.
|
default Opener<R,Attributes,?> |
getOpener()
Override to implement opening behaviour.
|
Tag<T,R> |
getSelf()
Enforce implementation of a self member.
|
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 |
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 |
matches(String uri,
String localName,
String qName,
Attributes attributes)
True if this Tag matches the supplied open element arguments.
|
Object |
open(Object o,
Attributes attributes)
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.
|
String getTag()
R getItem(T t)
NB: A FlatTag provides itself as the member.
t - a context objectTag<T,R> getSelf()
Object open(Object o, Attributes attributes)
@SafeVarargs static <X> Tag<? super X,?>[] tags(Tag<? super X,?>... tags)
X - a derived super typetags - an argument list of Tagsstatic Map<String,String> getAttributesMap(Attributes attributes)
attributes - XML attributesvoid close(Object o, String text, Object cache)
default TagModel<? super R> getTagModel()
null
if there are no children.default boolean matches(String uri, String localName, String qName, Attributes attributes)
Default is true if localName equals the tag value or the tag value equals "*".
uri - a namespace urilocalName - a local tag nameqName - a qualified tag nameattributes - SAX attributesdefault boolean isChoice()
default boolean isOptional()
default boolean isMultiple()
default Opener<R,Attributes,?> getOpener()
default Closer<R,String,?> getCloser()
default java.util.function.BiConsumer<Tag<T,R>,R> getValidator()
Copyright © 2021. All rights reserved.