Package omero.gateway.util
Class Utils
- java.lang.Object
-
- omero.gateway.util.Utils
-
public class Utils extends java.lang.Object
Collection of methods used to set the name of files to import and to handle enumerations.- Since:
- 5.1
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E extends omero.model.IObject>
java.util.List<java.lang.String>fromEnum(java.util.Collection<E> enumInstances)
Convert a list ofomero.model.enums
instances to their correspondingString
values.static java.lang.String
getDisplayedFileName(java.lang.String fullPath, java.lang.Integer number)
Returns the name to display for a file.static java.lang.String
getFolderAsContainerName(java.io.File file)
Returns the name as container if option is on.static java.lang.String
getStringSeparator(java.lang.String originalName)
Returns the separator ornull
.static boolean
isBlank(java.lang.String s)
static java.lang.String[]
splitString(java.lang.String originalName)
Returns the partial name of the image's namestatic <E extends omero.model.IObject,I extends E>
java.util.List<E>toEnum(java.lang.Class<E> enumClass, java.lang.Class<I> instanceClass, java.util.Collection<java.lang.String> enumValues)
Convert a list ofString
values to their correspondingomero.model.enums
instances.
-
-
-
Method Detail
-
getFolderAsContainerName
public static java.lang.String getFolderAsContainerName(java.io.File file)
Returns the name as container if option is on.- Returns:
- See above.
-
getDisplayedFileName
public static java.lang.String getDisplayedFileName(java.lang.String fullPath, java.lang.Integer number)
Returns the name to display for a file.- Parameters:
fullPath
- The file's absolute path.number
- The number of folder to set the name.- Returns:
- See above.
-
splitString
public static java.lang.String[] splitString(java.lang.String originalName)
Returns the partial name of the image's name- Parameters:
originalName
- The original name.- Returns:
- See above.
-
getStringSeparator
public static java.lang.String getStringSeparator(java.lang.String originalName)
Returns the separator ornull
.- Parameters:
originalName
- The original name.- Returns:
- See above.
-
toEnum
public static <E extends omero.model.IObject,I extends E> java.util.List<E> toEnum(java.lang.Class<E> enumClass, java.lang.Class<I> instanceClass, java.util.Collection<java.lang.String> enumValues) throws java.lang.ReflectiveOperationException
Convert a list ofString
values to their correspondingomero.model.enums
instances.- Parameters:
enumClass
- the desired enumeration type, nevernull
instanceClass
- the type whose no-argument constructor is used to provide instances ofenumClass
enumValues
- values of the enumeration type, nevernull
nor with anull
value- Returns:
- enumeration instances of the given type with the given values
- Throws:
java.lang.ReflectiveOperationException
- if the instances could not be created
-
fromEnum
public static <E extends omero.model.IObject> java.util.List<java.lang.String> fromEnum(java.util.Collection<E> enumInstances) throws java.lang.ReflectiveOperationException
Convert a list ofomero.model.enums
instances to their correspondingString
values.- Parameters:
enumInstances
- enumeration instances, nevernull
nor with anull
value- Returns:
- values of the given instances, never
null
- Throws:
java.lang.ReflectiveOperationException
- if the values could not be determined
-
isBlank
public static boolean isBlank(java.lang.String s)
-
-