October 2018
Intermediate to advanced
982 pages
23h 29m
English
public class BookFormatter implements Formatter<Book> {
private BookRepository repository;
public BookFormatter(BookRepository repository) {
this.repository= repository;
}
@Override
public Book parse(String bookIdentifier, Locale locale) throws ParseException { Book book = repository.findBookByIsbn(bookIdentifier); return book != null ? book : repository.findById(Long.valueOf(bookIdentifier)) .get(); } @Override public String ...Read now
Unlock full access