类 SheetConfig

java.lang.Object
gu.sql2java.excel.config.SheetConfig

public class SheetConfig extends Object
Excel表输出全局配置
作者:
guyadong
  • 构造器详细资料

    • SheetConfig

      public SheetConfig()
      默认构造方法
    • SheetConfig

      public SheetConfig(ExcelSheet sheetAnnot, ExcelColumn... columnAnnots)
      构造方法
      支持从注解ExcelSheet,ExcelColumn获取配置参数
      参数:
      sheetAnnot -
      columnAnnots -
    • SheetConfig

      public SheetConfig(Method method)
      构造方法,支持从服务方法中获取注解完成配置
      如果方法中定义了ExcelSheet注解,注解中定义了beanClass,则调用SheetConfig(Class)构造方法基于JavaBean类型构造当前实例,再调用SheetConfig(Method)构造方法基于方法构造一个临时实例, 将临时实例合并到当前实例
      参数:
      method -
    • SheetConfig

      public SheetConfig(Class<?> beanClass)
      构造方法,支持普通JavaBean类型
      参数:
      beanClass -
    • SheetConfig

      public SheetConfig(gu.sql2java.RowMetaData metaData)
      构造方法支持 UnnameRow记录
      参数:
      metaData -
    • SheetConfig

      public SheetConfig(Object bean)
      构造方法,支持普通JavaBean实例
      参数:
      bean -
    • SheetConfig

      public SheetConfig(Iterable<Map> iterable)
      构造方法,支持Map类型的记录对象包括JSONObject
      参数:
      iterable -
    • SheetConfig

      public SheetConfig(Iterable<Map> iterable, Iterable<String> includeCoumns)
      构造方法,支持Map类型的记录对象包括JSONObject
      参数:
      iterable -
      includeCoumns -
  • 方法详细资料

    • getSheetName

      public String getSheetName()
    • setSheetName

      public SheetConfig setSheetName(String sheetName)
    • getFileNamePrefix

      public String getFileNamePrefix()
      返回:
      fileNamePrefix
    • setFileNamePrefix

      public SheetConfig setFileNamePrefix(String fileNamePrefix)
      参数:
      fileNamePrefix - 要设置的 fileNamePrefix
      返回:
      当前对象
    • getTitle

      public String getTitle()
    • setTitle

      public SheetConfig setTitle(String title)
    • getTitleFontName

      public String getTitleFontName()
    • setTitleFontName

      public SheetConfig setTitleFontName(String titleFontName)
    • getTitleFontHeight

      public short getTitleFontHeight()
    • setTitleFontHeight

      public SheetConfig setTitleFontHeight(short titleFontHeight)
    • setTitleFontHeight

      public SheetConfig setTitleFontHeight(Integer titleFontHeight)
    • getTitleFontColor

      public org.apache.poi.ss.usermodel.IndexedColors getTitleFontColor()
    • setTitleFontColor

      public SheetConfig setTitleFontColor(org.apache.poi.ss.usermodel.IndexedColors titleFontColor)
    • setTitleFontColor

      public SheetConfig setTitleFontColor(String titleFontColor)
    • getTitleFillColor

      public org.apache.poi.ss.usermodel.IndexedColors getTitleFillColor()
    • setTitleFillColor

      public SheetConfig setTitleFillColor(org.apache.poi.ss.usermodel.IndexedColors titleFillColor)
    • setTitleFillColor

      public SheetConfig setTitleFillColor(String titleFillColor)
    • getTitleHorizontalAlign

      public org.apache.poi.ss.usermodel.HorizontalAlignment getTitleHorizontalAlign()
      返回:
      titleHorizontalAlign
    • setTitleHorizontalAlign

      public SheetConfig setTitleHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment titleHorizontalAlign)
      参数:
      titleHorizontalAlign - 要设置的 titleHorizontalAlign
      返回:
      当前对象
    • setTitleHorizontalAlign

      public SheetConfig setTitleHorizontalAlign(String titleHorizontalAlign)
      参数:
      titleHorizontalAlign - 要设置的 titleHorizontalAlign
      返回:
      当前对象
    • getHeaderFontName

      public String getHeaderFontName()
    • setHeaderFontName

      public SheetConfig setHeaderFontName(String headerFontName)
    • getHeaderFontHeight

      public short getHeaderFontHeight()
    • setHeaderFontHeight

      public SheetConfig setHeaderFontHeight(short headerFontHeight)
    • setHeaderFontHeight

      public SheetConfig setHeaderFontHeight(Integer headerFontHeight)
    • getHeaderFontColor

      public org.apache.poi.ss.usermodel.IndexedColors getHeaderFontColor()
    • setHeaderFontColor

      public SheetConfig setHeaderFontColor(org.apache.poi.ss.usermodel.IndexedColors headerFontColor)
    • setHeaderFontColor

      public SheetConfig setHeaderFontColor(String headerFontColor)
    • getHeaderFillColor

      public org.apache.poi.ss.usermodel.IndexedColors getHeaderFillColor()
    • setHeaderFillColor

      public SheetConfig setHeaderFillColor(org.apache.poi.ss.usermodel.IndexedColors headerFillColor)
    • setHeaderFillColor

      public SheetConfig setHeaderFillColor(String headerFillColor)
    • getHeaderHorizontalAlign

      public org.apache.poi.ss.usermodel.HorizontalAlignment getHeaderHorizontalAlign()
      返回:
      headerHorizontalAlign
    • setHeaderHorizontalAlign

      public SheetConfig setHeaderHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment headerHorizontalAlign)
      参数:
      headerHorizontalAlign - 要设置的 headerHorizontalAlign
      返回:
      当前对象
    • setHeaderHorizontalAlign

      public SheetConfig setHeaderHorizontalAlign(String headerHorizontalAlign)
      参数:
      headerHorizontalAlign - 要设置的 headerHorizontalAlign
      返回:
      当前对象
    • isFirstBold

      public boolean isFirstBold()
    • setFirstBold

      public SheetConfig setFirstBold(boolean firstBold)
    • setFirstBold

      public SheetConfig setFirstBold(Boolean firstBold)
    • getFontHeight

      public short getFontHeight()
    • setFontHeight

      public SheetConfig setFontHeight(short fontHeight)
    • setFontHeight

      public SheetConfig setFontHeight(Integer fontHeight)
    • getFontName

      public String getFontName()
    • setFontName

      public SheetConfig setFontName(String fontName)
    • getFontColor

      public org.apache.poi.ss.usermodel.IndexedColors getFontColor()
    • setFontColor

      public SheetConfig setFontColor(org.apache.poi.ss.usermodel.IndexedColors fontColor)
    • setFontColor

      public SheetConfig setFontColor(String fontColor)
    • getFillColor

      public org.apache.poi.ss.usermodel.IndexedColors getFillColor()
    • setFillColor

      public SheetConfig setFillColor(org.apache.poi.ss.usermodel.IndexedColors fillColor)
    • setFillColor

      public SheetConfig setFillColor(String fillColor)
    • getHorizontalAlign

      public org.apache.poi.ss.usermodel.HorizontalAlignment getHorizontalAlign()
    • setHorizontalAlign

      public SheetConfig setHorizontalAlign(org.apache.poi.ss.usermodel.HorizontalAlignment horizontalAlign)
    • setHorizontalAlign

      public SheetConfig setHorizontalAlign(String horizontalAlign)
    • getIntegralFormat

      public String getIntegralFormat()
    • setIntegralFormat

      public SheetConfig setIntegralFormat(String integralFormat)
    • getDateTimeFormat

      public String getDateTimeFormat()
    • setDateTimeFormat

      public SheetConfig setDateTimeFormat(String dateTimeFormat)
    • getDateFormat

      public String getDateFormat()
    • setDateFormat

      public SheetConfig setDateFormat(String dateFormat)
    • getTimeFormat

      public String getTimeFormat()
    • setTimeFormat

      public SheetConfig setTimeFormat(String timeFormat)
    • getTimestampFormat

      public String getTimestampFormat()
    • setTimestampFormat

      public SheetConfig setTimestampFormat(String timestampFormat)
    • getScale

      public int getScale()
    • setScale

      public SheetConfig setScale(int scale)
    • getRoundingMode

      public int getRoundingMode()
    • setRoundingMode

      public SheetConfig setRoundingMode(int roundingMode)
    • getMaxWidth

      public int getMaxWidth()
    • setMaxWidth

      public SheetConfig setMaxWidth(int maxWidth)
    • setMaxWidth

      public SheetConfig setMaxWidth(Integer maxWidth)
    • getMaxHeight

      public int getMaxHeight()
    • setMaxHeight

      public SheetConfig setMaxHeight(int maxHeight)
    • setMaxHeight

      public SheetConfig setMaxHeight(Integer maxHeight)
    • getDefaultValue

      public String getDefaultValue()
    • setDefaultValue

      public SheetConfig setDefaultValue(String defaultValue)
    • getIncludeColumns

      public Set<String> getIncludeColumns()
      返回:
      字段输出白名单
    • setIncludeColumns

      public SheetConfig setIncludeColumns(Set<String> includeColumns)
      另请参阅:
    • setIncludeColumns

      public SheetConfig setIncludeColumns(Iterable<String> includeColumns)
      指定要输出的字段(白名单),在此名单中的字段才会被输出, 此方法也定义了字段输出顺序,
      参数:
      includeColumns -
      返回:
      当前对象
    • setIncludeColumns

      public SheetConfig setIncludeColumns(String... includeColumns)
      另请参阅:
    • getExcludeColumns

      public Set<String> getExcludeColumns()
      返回:
      字段输出黑名单
    • setExcludeColumns

      public SheetConfig setExcludeColumns(Set<String> excludeColumns)
      另请参阅:
    • setExcludeColumns

      public SheetConfig setExcludeColumns(Iterable<String> excludeColumns)
      指定输出时要排序的字段(黑名单),在此名单中的字段不被输出
      参数:
      excludeColumns -
      返回:
      当前对象
    • setExcludeColumns

      public SheetConfig setExcludeColumns(String... excludeColumns)
      另请参阅:
    • getNestedNames

      public List<String> getNestedNames()
      返回所有嵌入字段
      从以下版本开始:
      3.29.4
    • getHideColumns

      public Set<String> getHideColumns()
      返回:
      hideColumns
    • setHideColumns

      public SheetConfig setHideColumns(Set<String> hideColumns)
      参数:
      hideColumns - 要设置的 hideColumns
      返回:
      当前对象
    • setHideColumns

      public SheetConfig setHideColumns(Iterable<String> hideColumns)
      参数:
      hideColumns - 要设置的 hideColumns
      另请参阅:
    • setHideColumns

      public SheetConfig setHideColumns(String... hideColumns)
      参数:
      hideColumns - 要设置的 hideColumns
      返回:
      当前对象
    • getDefaultIncludeColumns

      public Set<String> getDefaultIncludeColumns()
      返回:
      defaultIncludeColumns
    • setDefaultIncludeColumns

      public SheetConfig setDefaultIncludeColumns(Set<String> defaultIncludeColumns)
      参数:
      defaultIncludeColumns - 要设置的 defaultIncludeColumns
    • setDefaultIncludeColumns

      public void setDefaultIncludeColumns(Iterable<String> defaultIncludeColumns)
      参数:
      defaultIncludeColumns - 要设置的 defaultIncludeColumns
    • setDefaultIncludeColumns

      public void setDefaultIncludeColumns(String... defaultIncludeColumns)
      参数:
      defaultIncludeColumns - 要设置的 defaultIncludeColumns
    • getDynamicExcelNames

      public Set<String> getDynamicExcelNames()
      返回:
      dynamicExcelNames
      从以下版本开始:
      3.26.0
    • setDynamicExcelNames

      public void setDynamicExcelNames(Set<String> dynamicExcelNames)
      参数:
      dynamicExcelNames - 要设置的 dynamicExcelNames
      从以下版本开始:
      3.26.0
    • getExportedColumnConfigs

      public Iterable<PropertyConfig> getExportedColumnConfigs()
      返回需要导出的字段列表
      如果字段输出白名单(includeColumns)不为空则返回此名单中的字段配置对象 如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段;
    • getColumnConfigs

      public Iterable<PropertyConfig> getColumnConfigs()
      返回所有字段配置对象
    • setColumnConfigs

      public SheetConfig setColumnConfigs(Iterable<PropertyConfig> columnConfigs)
    • getBeanClass

      public Class<?> getBeanClass()
    • setBeanClass

      public void setBeanClass(Class<?> beanClass)
    • getCustomImporter

      public CustomBeanParser getCustomImporter()
    • setCustomImporter

      public void setCustomImporter(CustomBeanParser customImporter)
    • setCustomImporter

      public void setCustomImporter(Class<? extends CustomBeanParser> customImporterClass)
    • getQueueTimeout

      public int getQueueTimeout()
    • setQueueTimeout

      public void setQueueTimeout(int queueTimeout)
    • getTotalRowCount

      public long getTotalRowCount()
    • setTotalRowCount

      public void setTotalRowCount(long totalRowCount)
    • addColumns

      public SheetConfig addColumns(Iterable<PropertyConfig> elements)
    • addColumns

      public SheetConfig addColumns(PropertyConfig... elements)
    • addNestedColumns

      public SheetConfig addNestedColumns(Iterable<String> elements)
    • addNestedColumns

      public SheetConfig addNestedColumns(String... elements)
    • addNestedColumn

      public SheetConfig addNestedColumn(String nestedName, String descName)
    • exists

      public boolean exists(String nestedName)
    • configOrNullOf

      public PropertyConfig configOrNullOf(String nestedName)
      根据属性路径名查找对应的属性配置对象,没找到返回null
      参数:
      nestedName -
    • configByExcelName

      public PropertyConfig configByExcelName(String excelName)
      根据EXCEL输出字段名名查找对应的属性配置对象,没找到返回null,如果有多个匹配返回第一个
      参数:
      excelName - 为null或空返回null
      从以下版本开始:
      3.26.0
    • configOf

      public PropertyConfig configOf(String nestedName)
      根据属性路径名查找对应的属性配置对象,没找到返回则创建一个默认对象
      查找时如果没有找到完全匹配的值会自动切换节点名为驼峰命名格式或蛇形命名格式尝试
      参数:
      nestedName -
    • getRowHeight

      public short getRowHeight()
      根据注解获取最大行高
    • merge

      public SheetConfig merge(SheetConfig other)
      将输入的Excel表配置与当前对象的合并
      other中有定义的Excel Sheet配置字段复制到当前对象的对应字段
      other定义的Excel Column配置对象(PropertyConfig)合并到当前的Column配置对象中,如果存在相同的对象,则以other的为准,
      如果other.beanClass不为null则复制到当前对象的同名字段
      参数:
      other -
      返回:
      当前对象
      另请参阅:
    • getAvailableColumns

      public Map<String,String> getAvailableColumns()
      返回所有可输出字段及字段显示名称
    • getImportColumnConfigs

      public Collection<PropertyConfig> getImportColumnConfigs()
      返回需要导出的字段列表
      如果字段输出黑名单excludeColumns不为空则返回不在此名单中的所有字段配置对象 否则返回所有字段;
      从以下版本开始:
      3.29.4
    • getExcelConfigs

      public Map<String,PropertyConfig> getExcelConfigs()
      返回所有EXCEL字段名称-PropertyConfig映射
      从以下版本开始:
      3.29.0
    • getDefaultExportColumns

      public Map<String,String> getDefaultExportColumns()
      根据defaultIncludeColumns过滤返回默认输出的字段名和Excel导出时的列名
    • getDefaultExportColumnNames

      public Set<String> getDefaultExportColumnNames()
      根据defaultIncludeColumns过滤返回默认输出的字段名
    • setIncludeColumnsOrDefault

      public SheetConfig setIncludeColumnsOrDefault(Iterable<String> includeColumns)
      指定要输出的字段(白名单),如果输入参数为null或空,则使用getDefaultExportColumnNames()的返回值
      参数:
      includeColumns -
      返回:
      当前对象
      另请参阅:
    • getIncludeColumnsOrDefault

      public Set<String> getIncludeColumnsOrDefault()
    • mayBeJavaBean

      public static boolean mayBeJavaBean(Class<?> type)