Report Generator

@Alex Ljunggren Alex Ljunggren authored on 21 Jul 2024
src Added big decimal 4 years ago
.gitignore Initial Commit 6 years ago
README.md Updated notes 2 years ago
lombok.config Added unit tests, refactored using AccessibleObjects 5 years ago
pom.xml Update lombok and junit versions 4 years ago
README.md

Report Generator

Annotate member variables or methods that will appear on the report

@Reportable(headerName = "Name", column = "A")

Annotate reportable member variables or methods with formatters (optional)

@DateFormatter(format = "yyyy-MM-dd")
@DecimalFormatter(format = "#.00")
@StringFormatter(format = Format.UPPERCASE)
@CurrencyFormatter(format = Currency.USD)
@BooleanFormatter(falseText = "Not Valid", trueText = "Valid")
@NullFormatter(replacementText = "No Data")
@CommaFormatter
@TrimFormatter

Instantiate and generate

new CSVGenerator(List<?> data, char delimiter).generate(); // returns CSV String
new ExcelGenerator(List<?> data).generate(); // returns POI Workbook

Auto Size

@AutoSize
@Reportable(headerName = "Name", column = "A")

AutoSize coupled with Reportable will set the Excel columns to auto-adjust with column width to fit content

Date Formatter

@DateFormatter(format = "yyyy-MM-dd")

Data types supported

  • java.util.Date

Format used by java.text.SimpleDateFormat

Decimal Formatter

@DecimalFormatter(format = "#.00")

Data types supported

  • Integer
  • Double
  • Float
  • Long

Format used by java.text.DecimalFormat

String Formatter

@StringFormatter(format = Format.UPPERCASE)

Data types supported

  • String

Options

  • Format.UPPERCASE
  • Format.LOWERCASE
  • Format.CAPITALIZE
  • Format.CAPITALIZE_FULLY

Currency Formatter

@CurrencyFormatter(format = Currency.USD)

Data types supported

  • Integer
  • Double
  • Float
  • Long
  • Big Decimal

Options

  • Format.USD

Boolean Formatter

@BooleanFormatter(falseText = "Not Valid", trueText = "Valid")

Arguments

  • falseText
  • trueText

Null Formatter

@NullFormatter(replacementText = "No Data")

Data ytpes supported

  • All Objects

Arguments

  • replacementText

Comma Formatter

@CommaFormatter

Data types supported

  • Integer
  • Double
  • Long

Trim Formatter

@TrimFormatter

Data types supported

  • String