Package org.gbif.api.util
Class MachineTagUtils
java.lang.Object
org.gbif.api.util.MachineTagUtils
Utility class to simplify your life when dealing with machine tags.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends MachineTaggable>
List<T>Returns a copy of the original list of machine taggable entities, that have the machine tag.static MachineTag
firstTag
(MachineTaggable taggable, String namespace, String tagName) static <T> T
firstTag
(MachineTaggable taggable, String namespace, String tagName, Function<MachineTag, T> function) static MachineTag
firstTag
(MachineTaggable taggable, TagName tagName) static <T> T
firstTag
(MachineTaggable taggable, TagName tagName, Function<MachineTag, T> function) static List<MachineTag>
list
(MachineTaggable taggable, String namespace, String tagName) static List<MachineTag>
list
(MachineTaggable taggable, TagName tagName) static List<MachineTag>
list
(MachineTaggable taggable, TagNamespace tagNamespace) static List<MachineTag>
listByPrefix
(MachineTaggable taggable, String namespace, String prefix) static Double
static Integer
-
Method Details
-
filter
public static <T extends MachineTaggable> List<T> filter(List<T> source, @Nullable String namespace, @Nullable String name, @Nullable String value) Returns a copy of the original list of machine taggable entities, that have the machine tag. -
tagValueAsInteger
- Returns:
- the int value for the given machine tag or zero if its no valid integer or null
-
tagValueAsDouble
- Returns:
- the double value for the given machine tag or zero if its no valid double or null
-
firstTag
- Returns:
- the first machine tag that with the given TagName.
-
firstTag
- Returns:
- the first machine tag that with the given namespace and name.
-
firstTag
public static <T> T firstTag(MachineTaggable taggable, TagName tagName, Function<MachineTag, T> function) - Returns:
- the result of applying the supplied function to the first machine tag with the given TagName.
-
firstTag
public static <T> T firstTag(MachineTaggable taggable, String namespace, String tagName, Function<MachineTag, T> function) - Returns:
- the result of applying the supplied function to the first machine tag with the given namespace and name.
-
list
- Returns:
- a new list of machine tags which have the given tagNamespace.
-
list
- Returns:
- a new list of machine tags which have the given tagName.
-
list
- Returns:
- a new list of machine tags which have the given namespace and name.
-
listByPrefix
public static List<MachineTag> listByPrefix(MachineTaggable taggable, String namespace, String prefix) - Returns:
- a new list of machine tags which have the given namespace and a name starting with a common prefix.
-