Java tutorial
/* VotationToStringConverter.java * * Copyright (C) 2013 Universidad de Sevilla * * The use of this project is hereby constrained to the conditions of the * TDG Licence, a copy of which you may download from * http://www.tdg-seville.info/License.html * */ package converters; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import domain.Vote; @Component @Transactional public class VoteToStringConverter implements Converter<Vote, String> { @Override public String convert(Vote vote) { Assert.notNull(vote); String result; result = String.valueOf(vote.getId()); return result; } }