Package org.gbif.api.util
Class MachineTagUtils
- java.lang.Object
-
- org.gbif.api.util.MachineTagUtils
-
public class MachineTagUtils extends Object
Utility class to simplify your life when dealing with machine tags.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends MachineTaggable>
List<T>filter(List<T> source, String namespace, String name, String value)
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
tagValueAsDouble(MachineTag tag)
static Integer
tagValueAsInteger(MachineTag tag)
-
-
-
Method Detail
-
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
public static Integer tagValueAsInteger(MachineTag tag)
- Returns:
- the int value for the given machine tag or zero if its no valid integer or null
-
tagValueAsDouble
public static Double tagValueAsDouble(MachineTag tag)
- Returns:
- the double value for the given machine tag or zero if its no valid double or null
-
firstTag
public static MachineTag firstTag(MachineTaggable taggable, TagName tagName)
- Returns:
- the first machine tag that with the given TagName.
-
firstTag
public static MachineTag firstTag(MachineTaggable taggable, String namespace, String tagName)
- 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
public static List<MachineTag> list(MachineTaggable taggable, TagNamespace tagNamespace)
- Returns:
- a new list of machine tags which have the given tagNamespace.
-
list
public static List<MachineTag> list(MachineTaggable taggable, TagName tagName)
- Returns:
- a new list of machine tags which have the given tagName.
-
list
public static List<MachineTag> list(MachineTaggable taggable, String namespace, String tagName)
- 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.
-
-