Skip to content

autores-uk/format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Document javadoc

AutoRes Format

A better java.text.MessageFormat.

// parse to immutable, thread-safe formatter
var expression = FormatExpression.parse("Hello, {0}!");
// format
String result = expression.format(Locale.getDefault(), "World");
// print "Hello, World!"
System.out.println(result);

Features

  • Immutable, thread-safe parsed expressions
  • Supports JDK23 expressions at lower JDK versions
  • Exposes more parsed expression metadata

Implementation Notes

  • FormatExpression uses the same Format types under the covers for numbers, lists and date/times as MessageFormat to ensure maximum compatibility with the runtime JDK
  • Format types attempt to solve two problems - format and parse; this library only formats
  • Parsing ListFormat expressions like {0,list} is supported in JDK17+ but formatting such expressions requires a JDK22+ runtime

Binaries

Published artifacts can be found in the Maven Central Repository.

Version numbers follow a JDK.Major.Minor scheme.

Building

Source and target are JDK17. Requires JDK23 to execute unit tests.

Use Maven wrapper scripts to build:

code/format/mvnw -f code/format/pom.xml clean install

Branches & Tags

Development is done on the main branch. Releases are tagged as release/$version.

About

Better than java.text.MessageFormat.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •