Class MetaDataUtils
- java.lang.Object
-
- ru.ispras.microtesk.model.metadata.MetaDataUtils
-
public final class MetaDataUtils extends java.lang.Object
TheMetaDataUtils
class contains utility methods to deal with objects implementing theMetaData
interface.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends MetaData>
java.util.Map<java.lang.String,T>toMap(java.util.Collection<T> c)
TakesMetaData
objects from the specified collection and puts them to a map, where names of the objects are used as keys.static java.util.List<java.lang.String>
toNameList(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a list containing their names.static java.lang.String
toNameListString(java.util.Collection<? extends MetaData> c, java.lang.String sep)
Takes a collection ofMetaData
objects and creates a string that consists of their names separated with the specified separator string.static java.lang.String
toNameListStringRecursive(java.util.Collection<? extends MetaData> c, java.lang.String sep)
Takes a collection ofMetaData
objects and creates a string that consists of their names separated with the specified separator string.static java.util.Set<java.lang.String>
toNameSet(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a set containing their names.static java.util.Set<java.lang.String>
toNameSetRecursive(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a set containing names of their elements.
-
-
-
Method Detail
-
toMap
public static <T extends MetaData> java.util.Map<java.lang.String,T> toMap(java.util.Collection<T> c)
TakesMetaData
objects from the specified collection and puts them to a map, where names of the objects are used as keys. The order of objects is preserved.- Type Parameters:
T
- Exact type ofMetaData
objects.- Parameters:
c
- Collection ofMetaData
objects.- Returns:
- Map of
MetaData
objects.
-
toNameSet
public static java.util.Set<java.lang.String> toNameSet(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a set containing their names. The order of objects is preserved.- Parameters:
c
- Collection ofMetaData
objects.- Returns:
- Set of
MetaData
object names.
-
toNameSetRecursive
public static java.util.Set<java.lang.String> toNameSetRecursive(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a set containing names of their elements. If an object in the collection is represented by a group, its elements are added to the set in a recursive manner. The order of objects is preserved.- Parameters:
c
- Collection ofMetaData
objects.- Returns:
- Set of
MetaData
object names.
-
toNameList
public static java.util.List<java.lang.String> toNameList(java.util.Collection<? extends MetaData> c)
Takes a collection ofMetaData
objects and creates a list containing their names. The order of objects is preserved.- Parameters:
c
- Collection ofMetaData
objects.- Returns:
- List of
MetaData
object names.
-
toNameListString
public static java.lang.String toNameListString(java.util.Collection<? extends MetaData> c, java.lang.String sep)
Takes a collection ofMetaData
objects and creates a string that consists of their names separated with the specified separator string. The order of objects is preserved.- Parameters:
c
- Collection ofMetaData
objects.sep
- Separator string.- Returns:
- String containing a list of
MetaData
object names or empty string of the collection is empty.
-
toNameListStringRecursive
public static java.lang.String toNameListStringRecursive(java.util.Collection<? extends MetaData> c, java.lang.String sep)
Takes a collection ofMetaData
objects and creates a string that consists of their names separated with the specified separator string. The order of objects is preserved. If objects in the collection represent groups, they are processed recursively to create a list of their items.- Parameters:
c
- Collection ofMetaData
objects.sep
- Separator string.- Returns:
- String containing a list of
MetaData
object names or empty string of the collection is empty.
-
-