Class SpreadsheetUtils

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    @Component
    public class SpreadsheetUtils
    extends Object
    implements org.springframework.context.ApplicationContextAware
    • Field Detail

      • SHEET_NAME_SIZE

        public static final int SHEET_NAME_SIZE
        The Constant SHEET_NAME_SIZE.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SpreadsheetUtils

        public SpreadsheetUtils()
    • Method Detail

      • getAnnotation

        public static <T extends Annotation> T getAnnotation​(Class<?> classExcel,
                                                             Class<T> classAnnotation)
        Gets the annotation.
        Type Parameters:
        T - the generic type
        Parameters:
        classExcel - the class excel
        classAnnotation - the class annotation
        Returns:
        the annotation
      • getAnnotation

        public static <T extends Annotation> T getAnnotation​(Field field,
                                                             Class<T> classAnnotation)
        Gets the annotation.
        Type Parameters:
        T - the generic type
        Parameters:
        field - the field
        classAnnotation - the class annotation
        Returns:
        the annotation
      • reflectionAnnotation

        public static <T,​K extends Annotation> T reflectionAnnotation​(T entity,
                                                                            K annotation)
        Reflection annotation.
        Type Parameters:
        T - the generic type
        K - the key type
        Parameters:
        entity - the entity
        annotation - the annotation
        Returns:
        the t
      • getListField

        public static Set<Field> getListField​(Class<?> classComponentExcel)
        Gets the list field.
        Parameters:
        classComponentExcel - the class component excel
        Returns:
        the list field
      • getMapField

        public static Map<String,​Field> getMapField​(Class<?> classComponentExcel)
        Gets the map field.
        Parameters:
        classComponentExcel - the class component excel
        Returns:
        the map field
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext ac)
                                   throws org.springframework.beans.BeansException
        Sets the application context.
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Parameters:
        ac - the new application context
        Throws:
        org.springframework.beans.BeansException - the beans exception
      • getApplicationContext

        public static org.springframework.context.ApplicationContext getApplicationContext()
        Gets the application context.
        Returns:
        the application context
      • writeToFile

        public static void writeToFile​(String pathFile,
                                       String fileName,
                                       String typeFile,
                                       byte[] data)
        Write to file.
        Parameters:
        pathFile - the path file
        fileName - the file name
        typeFile - the type file
        data - the dati