refactor AbstractFormatter.java