Package com.gengoai
Interface Tag
-
- All Known Subinterfaces:
TokenDef
- All Known Implementing Classes:
CommonTypes
,ConfigTokenType
,EnumValue
,HierarchicalEnumValue
,StringTag
public interface Tag
A Tag represents a label on an object. Tags allow for instanceOf checks using
isInstance(Tag)
andisInstance(Tag...)
. Individual implementations may define theisInstance
method to take into account a hierarchy or other attributes that define a tag.- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
isInstance(@NonNull Tag tag)
Determines if this tag is an instance of a given tag.default boolean
isInstance(@NonNull Tag... tags)
Determines if this tag is an instance of any of the given tags.default String
label()
Gets the label associated with the tag.String
name()
The name of the tag.default Tag
parent()
Gets the parent of this tag
-
-
-
Method Detail
-
isInstance
default boolean isInstance(@NonNull @NonNull Tag tag)
Determines if this tag is an instance of a given tag.- Parameters:
tag
- The given tag to check if this one is an instance of- Returns:
- True if this tag is an instance of the given tag
-
isInstance
default boolean isInstance(@NonNull @NonNull Tag... tags)
Determines if this tag is an instance of any of the given tags.- Parameters:
tags
- the tags to check against- Returns:
- True if this tag is an instance of any one of the given tags
-
label
default String label()
Gets the label associated with the tag. In most cases the label is the same as the name, but when tags are defined using aHierarchicalEnumValue
the label is the leaf node name without the full path.- Returns:
- the label of the tag
-
name
String name()
The name of the tag.- Returns:
- The name of the tag
-
parent
default Tag parent()
Gets the parent of this tag- Returns:
- the parent or null if it has no parent
-
-