Class 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 of omero.model.enums instances to their corresponding String 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 or null.
      static boolean isBlank​(java.lang.String s)  
      static java.lang.String[] splitString​(java.lang.String originalName)
      Returns the partial name of the image's name
      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)
      Convert a list of String values to their corresponding omero.model.enums instances.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • 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 or null.
        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 of String values to their corresponding omero.model.enums instances.
        Parameters:
        enumClass - the desired enumeration type, never null
        instanceClass - the type whose no-argument constructor is used to provide instances of enumClass
        enumValues - values of the enumeration type, never null nor with a null 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 of omero.model.enums instances to their corresponding String values.
        Parameters:
        enumInstances - enumeration instances, never null nor with a null 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)