Package org.jboss.windup.config.tags
Class TagService
- java.lang.Object
-
- org.jboss.windup.config.tags.TagService
-
@Singleton public class TagService extends Object
Manages the relations between Windup tags and provides API to query these relations.- Author:
- Ondrej Zizka, ozizka at redhat.com
-
-
Constructor Summary
Constructors Constructor Description TagService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TagfindTag(String tagName)Returns theTagwith the provided name.Collection<Tag>getAllTags()Set<Tag>getAncestorTags(Tag tag)Returns all tags that designate this tag.Set<Tag>getDescendantTags(Tag tag)Returns all tags that are designated by this tag.TaggetOrCreateTag(String tagName, boolean isRef)List<Tag>getPrimeTags()Gets all tags that are "prime" tags.List<Tag>getRootTags()Returns the tags that were root in the definition files.TaggetTag(String tagName)booleanisUnderTag(String superTagName, String subTagName)Convenience method, calls this.isUnderTag(Tag superTag, Tag subTag).booleanisUnderTag(Tag superTag, Tag subTag)voidreadTags(InputStream tagsXML)Read the tag structure from the provided stream.StringtoString()voidwriteTagsToJavaScript(Writer writer)Writes the JavaScript code describing the tags as Tag classes to given writer.
-
-
-
Method Detail
-
getAllTags
public Collection<Tag> getAllTags()
-
readTags
public void readTags(InputStream tagsXML)
Read the tag structure from the provided stream.
-
getRootTags
public List<Tag> getRootTags()
Returns the tags that were root in the definition files. These serve as entry point shortcuts when browsing the graph. We could reduce this to just fewer as the root tags may be connected through parents="...".
-
getOrCreateTag
public Tag getOrCreateTag(String tagName, boolean isRef)
- Parameters:
isRef- True if the given tag name is a reference, in which case it should already exist.
-
getAncestorTags
public Set<Tag> getAncestorTags(Tag tag)
Returns all tags that designate this tag. E.g., for "tesla-model3", this would return "car", "vehicle", "vendor-tesla" etc.
-
getDescendantTags
public Set<Tag> getDescendantTags(Tag tag)
Returns all tags that are designated by this tag. E.g., for "vehicle", this would return "ship", "car", "tesla-model3", "bike", etc.
-
isUnderTag
public boolean isUnderTag(String superTagName, String subTagName)
Convenience method, calls this.isUnderTag(Tag superTag, Tag subTag).
-
isUnderTag
public boolean isUnderTag(Tag superTag, Tag subTag)
- Returns:
- true if the subTag is contained directly or indirectly in the superTag.
-
writeTagsToJavaScript
public void writeTagsToJavaScript(Writer writer) throws IOException
Writes the JavaScript code describing the tags as Tag classes to given writer.- Throws:
IOException
-
-