Class TagRepository
java.lang.Object
com.webfirmframework.wffweb.tag.html.AbstractHtmlRepository
com.webfirmframework.wffweb.tag.repository.TagRepository
- All Implemented Interfaces:
Serializable
TagRepository
class for tag operations like finding tags/attributes
with certain criteria, upserting/deleting wffObjects from tag etc... The
object of TagRepository
class may be got by
BrowserPage.getTagRepository()
method.- Since:
- 2.1.8
- See Also:
-
Constructor Summary
ConstructorDescriptionTagRepository
(Object accessObject, BrowserPage browserPage, AbstractHtml... rootTags) Deprecated.since 3.0.0TagRepository
(Object accessObject, BrowserPage browserPage, Map<String, AbstractHtml> tagByWffId, AbstractHtml... rootTags) This constructor is only for internal use. -
Method Summary
Modifier and TypeMethodDescriptionBuilds all attributes stream from all tags.buildAllAttributesStream
(boolean parallel) Finds all attributes as stream from all tags.static Stream<AbstractAttribute>
buildAllAttributesStream
(boolean parallel, AbstractHtml... fromTags) Builds all attributes stream from the given tags.static Stream<AbstractAttribute>
buildAllAttributesStream
(AbstractHtml... fromTags) Builds all attributes stream from the given tags.buildAllTagsStream
(boolean parallel) Finds all tags excludingNoTag
.static Stream<AbstractHtml>
buildAllTagsStream
(boolean parallel, AbstractHtml... fromTags) Builds all tags stream from the given tags and its nested children.static Stream<AbstractHtml>
buildAllTagsStream
(AbstractHtml... fromTags) Builds all tags stream from the given tags and its nested children.void
delete
(AbstractHtml tag, String key) Deletes the key-WffBMObject/WffBMArray pair from thewffObjects
property of tag.void
execute
(BrowserPageAction pageAction) Performs the givenBrowserPageAction
.boolean
Executes the JavaScript at the client browser page.boolean
exists
(AbstractHtml tag) Checks the existence of a tag instance.boolean
exists
(AbstractAttribute attribute) Checks the existence of an attribute instance.Finds all attributes from all tags.findAllAttributes
(boolean parallel) Finds all attributes from all tags.static Collection<AbstractAttribute>
findAllAttributes
(boolean parallel, AbstractHtml... fromTags) Finds all attributes from the given tagsstatic Collection<AbstractAttribute>
findAllAttributes
(AbstractHtml... fromTags) Finds all attributes from the given tagsFinds all tags excludingNoTag
.findAllTags
(boolean parallel) Finds all tags excludingNoTag
.static Collection<AbstractHtml>
findAllTags
(boolean parallel, AbstractHtml... fromTags) Finds all tags including the nested tags (and includingNoTag
) from the given tags.static Collection<AbstractHtml>
findAllTags
(AbstractHtml... fromTags) Finds all tags including the nested tags (and includingNoTag
) from the given tags.findAttributesByAttributeFilter
(boolean parallel, Predicate<? super AbstractAttribute> filter) Finds and returns the collection of attributes (including from nested tags) of the tags filtered by the given filterstatic Collection<AbstractAttribute>
findAttributesByAttributeFilter
(boolean parallel, Predicate<? super AbstractAttribute> filter, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter.findAttributesByAttributeFilter
(Predicate<? super AbstractAttribute> filter) Finds and returns the collection of attributes (including from nested tags) of the tags filtered by the given filterstatic Collection<AbstractAttribute>
findAttributesByAttributeFilter
(Predicate<? super AbstractAttribute> filter, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter.static Collection<AbstractAttribute>
findAttributesByTagFilter
(boolean parallel, Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags by the given filterstatic Collection<AbstractAttribute>
findAttributesByTagFilter
(Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags by the given filterfindAttributesByTagName
(boolean parallel, String tagName) Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.static Collection<AbstractAttribute>
findAttributesByTagName
(boolean parallel, String tagName, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.findAttributesByTagName
(String tagName) Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.static Collection<AbstractAttribute>
findAttributesByTagName
(String tagName, AbstractHtml... fromTags) Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.Finds thebody
tag.findBodyTag
(boolean parallel) Finds thebody
tag.static <T extends AbstractHtml>
TfindFirstParentTagAssignableToTag
(Class<T> tagClass, AbstractHtml fromTag) Finds and returns the first matching parent tag (including nested parent) (which is assignable to the given tag class).Finds thehead
tag.findHeadTag
(boolean parallel) Finds thehead
tag.<T extends AbstractHtml>
TfindOneTagAssignableToTag
(boolean parallel, Class<T> tagClass) Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).static <T extends AbstractHtml>
TfindOneTagAssignableToTag
(boolean parallel, Class<T> tagClass, AbstractHtml... fromTags) Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).<T extends AbstractHtml>
TfindOneTagAssignableToTag
(Class<T> tagClass) Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).static <T extends AbstractHtml>
TfindOneTagAssignableToTag
(Class<T> tagClass, AbstractHtml... fromTags) Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).findOneTagByAttribute
(boolean parallel, String attributeName, String attributeValue) Finds and returns the first (including the nested tags) matching with the given attribute name and value.static AbstractHtml
findOneTagByAttribute
(boolean parallel, String attributeName, String attributeValue, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given attribute name and value.findOneTagByAttribute
(AbstractAttribute attribute) Finds one tag by attribute instance.findOneTagByAttribute
(String attributeName, String attributeValue) Finds and returns the first (including the nested tags) matching with the given attribute name and value.static AbstractHtml
findOneTagByAttribute
(String attributeName, String attributeValue, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given attribute name and value.findOneTagByAttributeName
(boolean parallel, String attributeName) Finds and returns the first (including the nested tags) matching with the given attribute name.static AbstractHtml
findOneTagByAttributeName
(boolean parallel, String attributeName, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given attribute name.findOneTagByAttributeName
(String attributeName) Finds and returns the first (including the nested tags) matching with the given attribute name.static AbstractHtml
findOneTagByAttributeName
(String attributeName, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given attribute name.findOneTagByTagName
(boolean parallel, String tagName) Finds and returns the first (including the nested tags) matching with the given tag name.static AbstractHtml
findOneTagByTagName
(boolean parallel, String tagName, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given tag name.findOneTagByTagName
(String tagName) Finds and returns the first (including the nested tags) matching with the given tag name.static AbstractHtml
findOneTagByTagName
(String tagName, AbstractHtml... fromTags) Finds and returns the first (including the nested tags) matching with the given tag name.findTagById
(boolean parallel, String id) Finds and returns the first tag matching with the given id.static AbstractHtml
findTagById
(boolean parallel, String id, AbstractHtml... fromTags) Finds and returns the first tag matching with the given id.findTagById
(String id) Finds and returns the first tag matching with the given id.static AbstractHtml
findTagById
(String id, AbstractHtml... fromTags) Finds and returns the first tag matching with the given id.<T extends AbstractHtml>
Collection<T>findTagsAssignableToTag
(boolean parallel, Class<T> tagClass) Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).static <T extends AbstractHtml>
Collection<T>findTagsAssignableToTag
(boolean parallel, Class<T> tagClass, AbstractHtml... fromTags) Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).<T extends AbstractHtml>
Collection<T>findTagsAssignableToTag
(Class<T> tagClass) Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).static <T extends AbstractHtml>
Collection<T>findTagsAssignableToTag
(Class<T> tagClass, AbstractHtml... fromTags) Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).findTagsByAttribute
(boolean parallel, String attributeName, String attributeValue) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.static Collection<AbstractHtml>
findTagsByAttribute
(boolean parallel, String attributeName, String attributeValue, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.findTagsByAttribute
(AbstractAttribute attribute) Finds tags by attribute instance.findTagsByAttribute
(String attributeName, String attributeValue) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.static Collection<AbstractHtml>
findTagsByAttribute
(String attributeName, String attributeValue, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.findTagsByAttributeName
(boolean parallel, String attributeName) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.static Collection<AbstractHtml>
findTagsByAttributeName
(boolean parallel, String attributeName, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.findTagsByAttributeName
(String attributeName) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.static Collection<AbstractHtml>
findTagsByAttributeName
(String attributeName, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.findTagsByTagFilter
(boolean parallel, Predicate<? super AbstractHtml> filter) Finds and returns the collection of tags (including the nested tags but excludingNoTag
) filtered by the given filter.static Collection<AbstractHtml>
findTagsByTagFilter
(boolean parallel, Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags andNoTag
) filtered by the given filter.findTagsByTagFilter
(Predicate<? super AbstractHtml> filter) Finds and returns the collection of tags (including the nested tags but excludingNoTag
) filtered by the given filter.static Collection<AbstractHtml>
findTagsByTagFilter
(Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags andNoTag
) filtered by the given filter.findTagsByTagName
(boolean parallel, String tagName) Finds and returns the collection of tags (including the nested tags) matching with the give tag name and value.static Collection<AbstractHtml>
findTagsByTagName
(boolean parallel, String tagName, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the give tag name.findTagsByTagName
(String tagName) Finds and returns the collection of tags (including the nested tags) matching with the give tag name and value.static Collection<AbstractHtml>
findTagsByTagName
(String tagName, AbstractHtml... fromTags) Finds and returns the collection of tags (including the nested tags) matching with the give tag name.Finds thetitle
tag.findTitleTag
(boolean parallel) Finds thetitle
tag.getWffBMData
(AbstractHtml tag, String key) gets the WffBMObject/WffBMArray from thewffObjects
property of tag in the form of WffBMData.void
upsert
(AbstractHtml tag, String key, WffBMArray bmArray) Inserts or replaces (if already exists) the key bmArray pair in the wffObjects property of tag.void
upsert
(AbstractHtml tag, String key, WffBMObject bmObject) Inserts or replaces (if already exists) the key bmObject pair in the wffObjects property of tag.Methods inherited from class com.webfirmframework.wffweb.tag.html.AbstractHtmlRepository
addWffData, getAllNestedChildrenIncludingParent, getAttributeByNameLockless, getAttributesLockless, getReadLocks, getWffData, lockAndGetReadLocks, lockAndGetWriteLocks, loopThroughAllNestedChildren, removeWffData
-
Constructor Details
-
TagRepository
@Deprecated public TagRepository(Object accessObject, BrowserPage browserPage, AbstractHtml... rootTags) Deprecated.since 3.0.0This constructor is only for internal use. To get an object ofTagRepository
useBrowserPage#getTagRepository()
method.- Parameters:
browserPage
- the instance ofBrowserPage
rootTags
- the rootTags in the browserPage instance.- Since:
- 2.1.8
-
TagRepository
public TagRepository(Object accessObject, BrowserPage browserPage, Map<String, AbstractHtml> tagByWffId, AbstractHtml... rootTags) This constructor is only for internal use. To get an object ofTagRepository
useBrowserPage#getTagRepository()
method.- Parameters:
browserPage
- the instance ofBrowserPage
tagByWffId
- map containing wff id and its correspondingAbstractHtml
.rootTags
- the rootTags in the browserPage instance.- Since:
- 2.1.16
-
-
Method Details
-
findTagById
public static AbstractHtml findTagById(String id, AbstractHtml... fromTags) throws NullValueException Finds and returns the first tag matching with the given id.- Parameters:
id
- the value of id attribute.fromTags
- from the given tags and its nested children the finding to be done.- Returns:
- the first found tag with the given id
- Throws:
NullValueException
- if theid
orfromTags
is null- Since:
- 2.1.8
-
findTagById
public static AbstractHtml findTagById(boolean parallel, String id, AbstractHtml... fromTags) throws NullValueException Finds and returns the first tag matching with the given id.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.id
- the value of id attribute.fromTags
- from the given tags and its nested children the finding to be done.- Returns:
- the first found tag with the given id
- Throws:
NullValueException
- if theid
orfromTags
is null- Since:
- 3.0.0
-
findTagById
Finds and returns the first tag matching with the given id.- Parameters:
id
- the value of id attribute.- Returns:
- the first found tag with the given id
- Throws:
NullValueException
- if theid
is null- Since:
- 2.1.8
-
findTagById
Finds and returns the first tag matching with the given id.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.id
- the value of id attribute.- Returns:
- the first found tag with the given id
- Throws:
NullValueException
- if theid
is null- Since:
- 3.0.0
-
findTagsByAttribute
public static Collection<AbstractHtml> findTagsByAttribute(String attributeName, String attributeValue, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.- Parameters:
attributeName
- the name of the attribute.attributeValue
- the value of the attributefromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
,attributeValue
orfromTags
is null- Since:
- 2.1.8
-
findTagsByAttribute
public static Collection<AbstractHtml> findTagsByAttribute(boolean parallel, String attributeName, String attributeValue, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.attributeValue
- the value of the attributefromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
,attributeValue
orfromTags
is null- Since:
- 3.0.0
-
findTagsByTagName
public static Collection<AbstractHtml> findTagsByTagName(String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the give tag name.- Parameters:
tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given tag name .
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 2.1.11
-
findTagsByTagName
public static Collection<AbstractHtml> findTagsByTagName(boolean parallel, String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the give tag name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given tag name .
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByTagName
public static Collection<AbstractAttribute> findAttributesByTagName(String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.- Parameters:
tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the collection of attributes of the tags matching with the given tag name.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 2.1.11
-
findAttributesByAttributeFilter
public static Collection<AbstractAttribute> findAttributesByAttributeFilter(Predicate<? super AbstractAttribute> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter.- Parameters:
filter
- the filter lambda expression containing return true to include and false to exclude.fromTags
- from which the findings to be done.- Returns:
- the collection of attributes of the tags by the given filter.
- Throws:
NullValueException
- if thefilter
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByAttributeFilter
public static Collection<AbstractAttribute> findAttributesByAttributeFilter(boolean parallel, Predicate<? super AbstractAttribute> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.filter
- the filter lambda expression containing return true to include and false to exclude.fromTags
- from which the findings to be done.- Returns:
- the collection of attributes of the tags by the given filter.
- Throws:
NullValueException
- if thefilter
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByTagName
public static Collection<AbstractAttribute> findAttributesByTagName(boolean parallel, String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the collection of attributes of the tags matching with the given tag name.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByTagFilter
public static Collection<AbstractAttribute> findAttributesByTagFilter(Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter- Parameters:
filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of attributes of the tags by the given tag filter
- Throws:
NullValueException
- if thefilter
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByTagFilter
public static Collection<AbstractAttribute> findAttributesByTagFilter(boolean parallel, Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags by the given filter- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of attributes of the tags by the given tag filter
- Throws:
NullValueException
- if thefilter
orfromTags
is null- Since:
- 3.0.0
-
findOneTagByAttribute
public static AbstractHtml findOneTagByAttribute(String attributeName, String attributeValue, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name and value.- Parameters:
attributeName
- the name of the attribute.attributeValue
- the value of the attributefromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
,attributeValue
orfromTags
is null- Since:
- 2.1.8
-
findOneTagByAttribute
public static AbstractHtml findOneTagByAttribute(boolean parallel, String attributeName, String attributeValue, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name and value.- Parameters:
attributeName
- the name of the attribute.attributeValue
- the value of the attributefromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
,attributeValue
orfromTags
is null- Since:
- 3.0.0
-
findOneTagByTagName
public static AbstractHtml findOneTagByTagName(String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given tag name.- Parameters:
tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given tag name.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 2.1.11
-
findOneTagByTagName
public static AbstractHtml findOneTagByTagName(boolean parallel, String tagName, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given tag name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.fromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given tag name.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 3.0.0
-
findOneTagAssignableToTag
public static <T extends AbstractHtml> T findOneTagAssignableToTag(Class<T> tagClass, AbstractHtml... fromTags) throws NullValueException, InvalidTagException Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); }}; }}; TitleTag titleTag = TagRepository.findOneTagAssignableToTagClass(TitleTag.class, html); System.out.println(titleTag.getTagName()); System.out.println(titleTag.toHtmlString()); //prints title <title>some title</title>
- Parameters:
tagClass
- the class of the tag.fromTags
- from which the findings to be done.- Returns:
- the first matching tag which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
orfromTags
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 2.1.11
-
findOneTagAssignableToTag
public static <T extends AbstractHtml> T findOneTagAssignableToTag(boolean parallel, Class<T> tagClass, AbstractHtml... fromTags) throws NullValueException, InvalidTagException Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); }}; }}; TitleTag titleTag = TagRepository.findOneTagAssignableToTagClass(TitleTag.class, html); System.out.println(titleTag.getTagName()); System.out.println(titleTag.toHtmlString()); //prints title <title>some title</title>
- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagClass
- the class of the tag.fromTags
- from which the findings to be done.- Returns:
- the first matching tag which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
orfromTags
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 3.0.0
-
findTagsAssignableToTag
public static <T extends AbstractHtml> Collection<T> findTagsAssignableToTag(Class<T> tagClass, AbstractHtml... fromTags) throws NullValueException, InvalidTagException Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); new Div(this) {{ new Div(this) {{ new Div(this); }}; }}; new Div(this); }}; }}; Collection<Head> heads = TagRepository.findTagsAssignableToTag(Head.class, html); Collection<Div> divs = TagRepository.findTagsAssignableToTag(Div.class, html); System.out.println(heads.size()); System.out.println(divs.size()); //prints 1 5
- Parameters:
tagClass
- the class of the tag.fromTags
- from which the findings to be done.- Returns:
- the all matching tags which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
orfromTags
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 2.1.11
-
findTagsAssignableToTag
public static <T extends AbstractHtml> Collection<T> findTagsAssignableToTag(boolean parallel, Class<T> tagClass, AbstractHtml... fromTags) throws NullValueException, InvalidTagException Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); new Div(this) {{ new Div(this) {{ new Div(this); }}; }}; new Div(this); }}; }}; Collection<Head> heads = TagRepository.findTagsAssignableToTag(Head.class, html); Collection<Div> divs = TagRepository.findTagsAssignableToTag(Div.class, html); System.out.println(heads.size()); System.out.println(divs.size()); //prints 1 5
- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagClass
- the class of the tag.fromTags
- from which the findings to be done.- Returns:
- the all matching tags which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
orfromTags
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 3.0.0
-
findOneTagByAttributeName
public static AbstractHtml findOneTagByAttributeName(String attributeName, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name.- Parameters:
attributeName
- the name of the attribute.fromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orfromTags
is null- Since:
- 2.1.8
-
findOneTagByAttributeName
public static AbstractHtml findOneTagByAttributeName(boolean parallel, String attributeName, AbstractHtml... fromTags) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.fromTags
- from which the findings to be done.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orfromTags
is null- Since:
- 3.0.0
-
findTagsByAttributeName
public static Collection<AbstractHtml> findTagsByAttributeName(String attributeName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.- Parameters:
attributeName
- the name of the attribute.fromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given attribute.
- Throws:
NullValueException
- if theattributeName
orfromTags
is null- Since:
- 2.1.8
-
findTagsByAttributeName
public static Collection<AbstractHtml> findTagsByAttributeName(boolean parallel, String attributeName, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.fromTags
- from which the findings to be done.- Returns:
- the collection of tags matching with the given attribute.
- Throws:
NullValueException
- if theattributeName
orfromTags
is null- Since:
- 3.0.0
-
findTagsByAttributeName
public Collection<AbstractHtml> findTagsByAttributeName(String attributeName) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.- Parameters:
attributeName
- the name of the attribute.- Returns:
- the collection of tags matching with the given attribute.
- Throws:
NullValueException
- if theattributeName
is null- Since:
- 2.1.8
-
findTagsByAttributeName
public Collection<AbstractHtml> findTagsByAttributeName(boolean parallel, String attributeName) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.- Returns:
- the collection of tags matching with the given attribute.
- Throws:
NullValueException
- if theattributeName
is null- Since:
- 3.0.0
-
findTagsByAttribute
public Collection<AbstractHtml> findTagsByAttribute(String attributeName, String attributeValue) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.- Parameters:
attributeName
- the name of the attribute.attributeValue
- the value of the attribute- Returns:
- the collection of tags matching with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orattributeValue
is null- Since:
- 2.1.8
-
findTagsByAttribute
public Collection<AbstractHtml> findTagsByAttribute(boolean parallel, String attributeName, String attributeValue) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the given attribute name and value.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.attributeValue
- the value of the attribute- Returns:
- the collection of tags matching with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orattributeValue
is null- Since:
- 3.0.0
-
findTagsByTagName
Finds and returns the collection of tags (including the nested tags) matching with the give tag name and value.- Parameters:
tagName
- the name of the tag.- Returns:
- the collection of tags matching with the given tag name and value.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 2.1.11
-
findTagsByTagName
public Collection<AbstractHtml> findTagsByTagName(boolean parallel, String tagName) throws NullValueException Finds and returns the collection of tags (including the nested tags) matching with the give tag name and value.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.- Returns:
- the collection of tags matching with the given tag name and value.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 3.0.0
-
findTagsByTagFilter
public Collection<AbstractHtml> findTagsByTagFilter(Predicate<? super AbstractHtml> filter) throws NullValueException Finds and returns the collection of tags (including the nested tags but excludingNoTag
) filtered by the given filter.- Parameters:
filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of tags by the given filter.
- Throws:
NullValueException
- if thePredicate filter
is null- Since:
- 3.0.0
-
findTagsByTagFilter
public Collection<AbstractHtml> findTagsByTagFilter(boolean parallel, Predicate<? super AbstractHtml> filter) throws NullValueException Finds and returns the collection of tags (including the nested tags but excludingNoTag
) filtered by the given filter.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of tags by the given filter.
- Throws:
NullValueException
- if thePredicate filter
is null- Since:
- 3.0.0
-
findTagsByTagFilter
public static Collection<AbstractHtml> findTagsByTagFilter(boolean parallel, Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags andNoTag
) filtered by the given filter.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of tags by the given filter.
- Throws:
NullValueException
- if thePredicate filter
orfromTags
is null- Since:
- 3.0.0
-
findTagsByTagFilter
public static Collection<AbstractHtml> findTagsByTagFilter(Predicate<? super AbstractHtml> filter, AbstractHtml... fromTags) throws NullValueException Finds and returns the collection of tags (including the nested tags andNoTag
) filtered by the given filter.- Parameters:
filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of tags matching with the given tag name and value.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 3.0.0
-
findAttributesByTagName
public Collection<AbstractAttribute> findAttributesByTagName(String tagName) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.- Parameters:
tagName
- the name of the tag.- Returns:
- the collection of attributes of the tags matching with the given tag name.
- Throws:
NullValueException
- if thetagName
orfromTags
is null- Since:
- 2.1.11
-
findAttributesByTagName
public Collection<AbstractAttribute> findAttributesByTagName(boolean parallel, String tagName) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags matching with the give tag name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.- Returns:
- the collection of attributes of the tags matching with the given tag name.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 3.0.0
-
findAttributesByAttributeFilter
public Collection<AbstractAttribute> findAttributesByAttributeFilter(Predicate<? super AbstractAttribute> filter) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags filtered by the given filter- Parameters:
filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of attributes by the given filter.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 3.0.0
-
findAttributesByAttributeFilter
public Collection<AbstractAttribute> findAttributesByAttributeFilter(boolean parallel, Predicate<? super AbstractAttribute> filter) throws NullValueException Finds and returns the collection of attributes (including from nested tags) of the tags filtered by the given filter- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.filter
- the filter lambda expression containing return true to include and false to exclude.- Returns:
- the collection of attributes by the given filter.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 3.0.0
-
findOneTagByAttribute
public AbstractHtml findOneTagByAttribute(String attributeName, String attributeValue) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name and value.- Parameters:
attributeName
- the name of the attribute.attributeValue
- the value of the attribute- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orattributeValue
is null- Since:
- 2.1.8
-
findOneTagByAttribute
public AbstractHtml findOneTagByAttribute(boolean parallel, String attributeName, String attributeValue) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name and value.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.attributeValue
- the value of the attribute- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
orattributeValue
is null- Since:
- 3.0.0
-
findOneTagByTagName
Finds and returns the first (including the nested tags) matching with the given tag name.- Parameters:
tagName
- the name of the tag.- Returns:
- the first matching tag with the given tag name.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 2.1.11
-
findOneTagByTagName
Finds and returns the first (including the nested tags) matching with the given tag name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagName
- the name of the tag.- Returns:
- the first matching tag with the given tag name.
- Throws:
NullValueException
- if thetagName
is null- Since:
- 3.0.0
-
findOneTagAssignableToTag
public <T extends AbstractHtml> T findOneTagAssignableToTag(Class<T> tagClass) throws NullValueException Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); }}; }}; TitleTag titleTag = TagRepository.findOneTagAssignableToTagClass(TitleTag.class, html); System.out.println(titleTag.getTagName()); System.out.println(titleTag.toHtmlString()); //prints title <title>some title</title>
- Parameters:
tagClass
- the class of the tag.- Returns:
- the first matching tag which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
is null- Since:
- 2.1.11
-
findOneTagAssignableToTag
public <T extends AbstractHtml> T findOneTagAssignableToTag(boolean parallel, Class<T> tagClass) throws NullValueException Finds and returns the first matching (including from nested tags) tag (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); }}; }}; TitleTag titleTag = TagRepository.findOneTagAssignableToTagClass(TitleTag.class, html); System.out.println(titleTag.getTagName()); System.out.println(titleTag.toHtmlString()); //prints title <title>some title</title>
- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagClass
- the class of the tag.- Returns:
- the first matching tag which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
is null- Since:
- 3.0.0
-
findTagsAssignableToTag
public <T extends AbstractHtml> Collection<T> findTagsAssignableToTag(Class<T> tagClass) throws NullValueException, InvalidTagException Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); new Div(this) {{ new Div(this) {{ new Div(this); }}; }}; new Div(this); }}; }}; Collection<Head> heads = TagRepository.findTagsAssignableToTag(Head.class, html); Collection<Div> divs = TagRepository.findTagsAssignableToTag(Div.class, html); System.out.println(heads.size()); System.out.println(divs.size()); //prints 1 5
- Parameters:
tagClass
- the class of the tag.- Returns:
- the all matching tags which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 2.1.11
-
findTagsAssignableToTag
public <T extends AbstractHtml> Collection<T> findTagsAssignableToTag(boolean parallel, Class<T> tagClass) throws NullValueException, InvalidTagException Finds and returns the all matching (including from nested tags) tags (which is assignable to the given tag class).
Html html = new Html(null) {{ new Head(this) {{ new TitleTag(this){{ new NoTag(this, "some title"); }}; }}; new Body(this, new Id("one")) {{ new Div(this); new Div(this) {{ new Div(this) {{ new Div(this); }}; }}; new Div(this); }}; }}; Collection<Head> heads = TagRepository.findTagsAssignableToTag(Head.class, html); Collection<Div> divs = TagRepository.findTagsAssignableToTag(Div.class, html); System.out.println(heads.size()); System.out.println(divs.size()); //prints 1 5
- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.tagClass
- the class of the tag.- Returns:
- the all matching tags which is assignable to the given tag class.
- Throws:
NullValueException
- if thetagClass
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 3.0.0
-
findOneTagByAttributeName
Finds and returns the first (including the nested tags) matching with the given attribute name.- Parameters:
attributeName
- the name of the attribute.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
is null- Since:
- 2.1.8
-
findOneTagByAttributeName
public AbstractHtml findOneTagByAttributeName(boolean parallel, String attributeName) throws NullValueException Finds and returns the first (including the nested tags) matching with the given attribute name.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.attributeName
- the name of the attribute.- Returns:
- the first matching tag with the given attribute name and value.
- Throws:
NullValueException
- if theattributeName
is null- Since:
- 3.0.0
-
findTagsByAttribute
public Collection<AbstractHtml> findTagsByAttribute(AbstractAttribute attribute) throws NullValueException Finds tags by attribute instance.- Parameters:
attribute
-- Returns:
- all tags which are consuming the given attribute instance. It returns the only tags consuming the given attribute object which are available in browserPage.
- Throws:
NullValueException
- if theattribute
is null- Since:
- 2.1.8
-
findOneTagByAttribute
Finds one tag by attribute instance.- Parameters:
attribute
-- Returns:
- the first matching tag consuming the given attribute instance. There must be a consuming tag which is available in the browserPage instance otherwise returns null.
- Throws:
NullValueException
- if theattribute
is null- Since:
- 2.1.8
-
upsert
public void upsert(AbstractHtml tag, String key, WffBMObject bmObject) throws InvalidTagException, NullValueException Inserts or replaces (if already exists) the key bmObject pair in the wffObjects property of tag. The conventional JavaScript object ofWffBMObject
will be set to thewffObjects
property of the given tag at client side.- Parameters:
tag
- the tag object on which the given bmObject to be set.key
- key to set in wffObjects property of the tag.bmObject
-- Throws:
InvalidTagException
- if the given instance is of NoTag / BlankNullValueException
- if tag, key or bmObject is null- Since:
- 2.1.8
-
upsert
public void upsert(AbstractHtml tag, String key, WffBMArray bmArray) throws InvalidTagException, NullValueException Inserts or replaces (if already exists) the key bmArray pair in the wffObjects property of tag. The conventional JavaScript array ofWffBMArray
will be set to thewffObjects
property of the given tag at client side.- Parameters:
tag
- the tag object on which the given bmArray to be set.key
- key to set in wffObjects property of the tag.bmArray
-- Throws:
InvalidTagException
- if the given instance is of NoTag / BlankNullValueException
- if tag, key or bmArray is null- Since:
- 2.1.8
-
delete
Deletes the key-WffBMObject/WffBMArray pair from thewffObjects
property of tag.- Parameters:
tag
-key
-- Throws:
InvalidTagException
- if the given instance is of NoTag / BlankNullValueException
- if tag or key is null- Since:
- 2.1.8
-
getWffBMData
public WffBMData getWffBMData(AbstractHtml tag, String key) throws InvalidTagException, NullValueException gets the WffBMObject/WffBMArray from thewffObjects
property of tag in the form of WffBMData.- Parameters:
tag
-key
-- Returns:
- WffBMData which may be type casted to either WffBMObject or WffBMArray.
- Throws:
InvalidTagException
- if the given instance is of NoTag / BlankNullValueException
- if tag or key is null- Since:
- 3.0.1
-
findAllTags
Finds all tags excludingNoTag
. To getNoTag
included collection use static methodTagRepository.findAllTags(AbstractHtml... fromTags)
. This method may perform better than the static method.- Returns:
- the collection of all tags
- Since:
- 2.1.8
-
findAllTags
Finds all tags excludingNoTag
. To getNoTag
included collection use static methodTagRepository.findAllTags(boolean parallel, AbstractHtml... fromTags)
. This method may perform better than the static method.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the collection of all tags
- Since:
- 3.0.0
-
buildAllTagsStream
Finds all tags excludingNoTag
.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the stream of all tags
- Since:
- 3.0.0
-
findAllTags
public static Collection<AbstractHtml> findAllTags(AbstractHtml... fromTags) throws NullValueException Finds all tags including the nested tags (and includingNoTag
) from the given tags.- Parameters:
fromTags
- to find all tags from these tags- Returns:
- all tags including the nested tags from the given tags.
- Throws:
NullValueException
- iffromTags
is null- Since:
- 2.1.9
-
findAllTags
public static Collection<AbstractHtml> findAllTags(boolean parallel, AbstractHtml... fromTags) throws NullValueException Finds all tags including the nested tags (and includingNoTag
) from the given tags.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.fromTags
- to find all tags from these tags- Returns:
- all tags including the nested tags from the given tags.
- Throws:
NullValueException
- iffromTags
is null- Since:
- 3.0.0
-
findAllAttributes
Finds all attributes from all tags.- Returns:
- the collection of all attributes
- Since:
- 2.1.8
-
findAllAttributes
Finds all attributes from all tags.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the collection of all attributes
- Since:
- 3.0.0
-
buildAllAttributesStream
Finds all attributes as stream from all tags.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the stream of all attributes
- Since:
- 3.0.0
-
findAllAttributes
public static Collection<AbstractAttribute> findAllAttributes(AbstractHtml... fromTags) throws NullValueException Finds all attributes from the given tags- Parameters:
fromTags
- the tags to find the attributes from.- Returns:
- the all attributes from the given tags including the nested tags.
- Throws:
NullValueException
- iffromTags
is null- Since:
- 2.1.9
-
findAllAttributes
public static Collection<AbstractAttribute> findAllAttributes(boolean parallel, AbstractHtml... fromTags) throws NullValueException Finds all attributes from the given tags- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.fromTags
- the tags to find the attributes from.- Returns:
- the all attributes from the given tags including the nested tags.
- Throws:
NullValueException
- iffromTags
is null- Since:
- 3.0.0
-
exists
Checks the existence of a tag instance.- Parameters:
tag
-- Returns:
- true if the given tag instance exists anywhere in the browser page.
- Throws:
NullValueException
- if the tag is nullInvalidTagException
- if the given tag isNoTag
.- Since:
- 2.1.8
-
exists
Checks the existence of an attribute instance.- Parameters:
attribute
-- Returns:
- true if the given attribute instance exists anywhere in the browser page.
- Throws:
NullValueException
- if theattribute
is null- Since:
- 2.1.8
-
executeJs
Executes the JavaScript at the client browser page. This method is equalent to calling
try { browserPage.performBrowserPageAction( BrowserPageAction.getActionByteBufferForExecuteJS(js)); return true; } catch (final UnsupportedEncodingException e) { e.printStackTrace(); }
tagRepository.executeJs("alert('This is an alert');");
- Parameters:
js
- the JavaScript to be executed at the client browser page.- Returns:
- true if the given js string is in a supported encoding otherwise false. Returning true DOESN'T mean the given js string is valid , successfully sent to the client browser to execute or executed successfully.
- Since:
- 2.1.11
-
execute
Performs the givenBrowserPageAction
. This method is equalent to callingbrowserPage.performBrowserPageAction(pageAction.getActionByteBuffer());
.
Eg, the below code reloads the client browser page.:-tagRepository.execute(BrowserPageAction.RELOAD);
- Parameters:
pageAction
- to perform the givenBrowserPageAction
- Since:
- 2.1.11
-
findBodyTag
Finds thebody
tag.- Returns:
- the
body
tag. If there are multiplebody
tags available any one of them will be returned. If nobody
tag found then null will be returned. - Since:
- 3.0.0
-
findBodyTag
Finds thebody
tag.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the
body
tag. If there are multiplebody
tags available any one of them will be returned. If nobody
tag found then null will be returned. - Since:
- 3.0.0
-
findHeadTag
Finds thehead
tag.- Returns:
- the
head
tag. If there are multiplehead
tags available any one of them will be returned. If nohead
tag found then null will be returned. - Since:
- 3.0.0
-
findHeadTag
Finds thehead
tag.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the
head
tag. If there are multiplehead
tags available any one of them will be returned. If nohead
tag found then null will be returned. - Since:
- 3.0.0
-
findTitleTag
Finds thetitle
tag.- Returns:
- the
title
tag. If there are multipletitle
tags available any one of them will be returned. If notitle
tag found then null will be returned. - Since:
- 3.0.0
-
findTitleTag
Finds thetitle
tag.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.- Returns:
- the
title
tag. If there are multipletitle
tags available any one of them will be returned. If notitle
tag found then null will be returned. - Since:
- 3.0.0
-
buildAllTagsStream
Builds all tags stream from the given tags and its nested children.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.fromTags
- the tags to to build stream of nested children from.- Returns:
Stream<AbstractHtml>
- Since:
- 3.0.0
-
buildAllTagsStream
Builds all tags stream from the given tags and its nested children.- Parameters:
fromTags
- the tags to build stream of nested children from.- Returns:
Stream<AbstractHtml>
- Since:
- 3.0.0
-
buildAllAttributesStream
Builds all attributes stream from the given tags.- Parameters:
fromTags
- the tags to build stream of nested children's attributes from.- Returns:
Stream<AbstractAttribute>
- Since:
- 3.0.0
-
buildAllAttributesStream
public static Stream<AbstractAttribute> buildAllAttributesStream(boolean parallel, AbstractHtml... fromTags) Builds all attributes stream from the given tags.- Parameters:
parallel
- true to internally use parallel stream. If true it will split the finding task to different batches and will execute the batches in different threads in parallel consuming all CPUs. It will perform faster in finding from extremely large number of tags but at the same time it will less efficient in finding from small number of tags.fromTags
- the tags to build stream of nested children's attributes from.- Returns:
Stream<AbstractAttribute>
- Since:
- 3.0.0
-
buildAllAttributesStream
Builds all attributes stream from all tags.- Returns:
Stream<AbstractAttribute>
- Since:
- 3.0.0
-
findFirstParentTagAssignableToTag
public static <T extends AbstractHtml> T findFirstParentTagAssignableToTag(Class<T> tagClass, AbstractHtml fromTag) throws NullValueException, InvalidTagException Finds and returns the first matching parent tag (including nested parent) (which is assignable to the given tag class).- Parameters:
tagClass
- the class of the tag.fromTag
- from which the findings to be done.- Returns:
- the first matching tag which is assignable to the given tag class or null if not found.
- Throws:
NullValueException
- if thetagClass
orfromTags
is nullInvalidTagException
- if the given tag class is NoTag.class- Since:
- 3.0.15
-