Package science.aist.gtf.graph
Interface MetaTagCollection
-
- All Known Subinterfaces:
Edge<V,E>
,EdgeView<V,E>
,Graph<V,E>
,Vertex<V,E>
,VertexView<V,E>
- All Known Implementing Classes:
AbstractEdge
,AbstractVertex
,EdgeImpl
,EdgeViewImpl
,GraphImpl
,MetaTagCollectionImpl
,VertexImpl
,VertexViewImpl
public interface MetaTagCollection
Allows adding MetaTag information to a specific class
- Since:
- 1.0
- Author:
- Andreas Pointner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> boolean
addMetaTag(MetaTag<T> metaTag)
Adds a meta tag to the current vertex<T> Collection<MetaTag<T>>
getMetaTags()
default <T> T
getMetaTagValue(String key)
Returns the first value for a meta tag with a given key or throws an exception if not presentdefault <T> T
getMetaTagValue(String key, Class<T> clazz)
Returns the value for a meta tag with a given keydefault void
removeMetaTag(String key, Class<?>... clazz)
Removes all meta that, where the key of the meta tag equals the key parameter.<T> boolean
removeMetaTag(MetaTag<T> metaTag)
Removes a meta tag from the current vertexdefault <T> Optional<T>
tryGetMetaTagValue(String key)
Try to return the first value for a meta tag with a given keydefault <T> Optional<T>
tryGetMetaTagValue(String key, Class<T> clazz)
Tries to get a value for a given meta tag with a given key
-
-
-
Method Detail
-
getMetaTags
<T> Collection<MetaTag<T>> getMetaTags()
- Type Parameters:
T
- returns a collection of all the meta tags- Returns:
- the collection of all current meta tags
-
getMetaTagValue
default <T> T getMetaTagValue(String key, Class<T> clazz)
Returns the value for a meta tag with a given key- Type Parameters:
T
- the type of the meta tag value- Parameters:
key
- the key of the meta tagclazz
- the class of the meta tag value- Returns:
- the value of the meta tag, if there are multiple elements with the same key and class type, the first one which is matching will be returned
- Throws:
IllegalStateException
- if no meta tag with the given key exists, or if the meta tag value does not match the clazz type.
-
tryGetMetaTagValue
default <T> Optional<T> tryGetMetaTagValue(String key, Class<T> clazz)
Tries to get a value for a given meta tag with a given key- Type Parameters:
T
- the type of the meta tag value- Parameters:
key
- the key of the meta tagclazz
- the class of the meta tag value- Returns:
- the value of the meta tag, if there are multiple elements with the same key class type, the first one which is matching will be returned
-
getMetaTagValue
default <T> T getMetaTagValue(String key)
Returns the first value for a meta tag with a given key or throws an exception if not present- Type Parameters:
T
- the type of the meta tag- Parameters:
key
- the key- Returns:
- the value if present
- See Also:
getMetaTagValue(String, Class)
-
tryGetMetaTagValue
default <T> Optional<T> tryGetMetaTagValue(String key)
Try to return the first value for a meta tag with a given key- Type Parameters:
T
- the type of the meta tag- Parameters:
key
- the key- Returns:
- the value if present
- See Also:
tryGetMetaTagValue(String, Class)
-
addMetaTag
<T> boolean addMetaTag(MetaTag<T> metaTag)
Adds a meta tag to the current vertex- Type Parameters:
T
- the type of the meta tag to add- Parameters:
metaTag
- the meta tag- Returns:
- a flag which indicates if the element was added
-
removeMetaTag
<T> boolean removeMetaTag(MetaTag<T> metaTag)
Removes a meta tag from the current vertex- Type Parameters:
T
- the type of the meta tag to remove- Parameters:
metaTag
- the meta tag- Returns:
- a flag which indicates if the element was removed
-
removeMetaTag
default void removeMetaTag(String key, Class<?>... clazz)
Removes all meta that, where the key of the meta tag equals the key parameter. Optionally it also checks if the value type is one of the given classes. If classes is null or empty it will only check for the key. After calling this method the meta tag with the associated key will be removed. In case the key does not exist, no error will occur.
- Parameters:
key
- the key of the meta tag to be removedclazz
- optional: a list of possible types where the meta tag must be one of them.
-
-