Replace Apache POI int type codes with CellType and HyperlinkType

MSAL

Apache POI 3.x describes cells and hyperlinks with int codes, which POI 4.0 replaced with the CellType and HyperlinkType enumerations. This recipe moves the accessors to the enum returning getCellTypeEnum(), getCachedFormulaResultTypeEnum(), evaluateFormulaCellEnum() and getTypeEnum(), the only ones POI 3.17 has, and replaces the Cell.CELL_TYPE_* and Hyperlink.LINK_* constants and the int literals used for them. Local variables and the parameters of private methods that hold a code become the enum, and switch labels become the unqualified names that every Java version accepts. A value that has to stay an int, such as the parameter of a public method, is converted at that boundary.

org.openrewrite.apache.poi.ReplaceTypeCodesWithEnums
mod run . --recipe=org.openrewrite.apache.poi.ReplaceTypeCodesWithEnums

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.