Skip to content
Eugene edited this page May 8, 2014 · 1 revision

How to use NoDTO:

  1. Download the jar from Dropbox location or check-out the project and compile it. There are Gradle and Maven scripts available.
  2. Put the library in your project or import it using Maven or Gradle
  3. Do something like following code snippet:

Example is based on GWT RemoteService

public UserService implements RemoteService {
    //This is the Serialization Path:
    private final static Set<String> SERIALIZATION_PATH = new HashSet<>(Arrays.asList("account", "account.address"));

    private SerializationPreprocessor _serializationPreprocessor = new  SerializationPreprocessor(
        new HibernatePersistenceConfig(), // This tells no-dto what is your ORM library
        new DefaultCodeStructureConfig()    //This allows you to give no-dto hints on how you code
    );
    private UserDao _userDao;
    
    public User load(Integer id) {
        User user = _userDao.find(123);
        return _serializationPreprocessor.prepare(user, SERIALIZATION_PATH).getEntity();
    }
}

Clone this wiki locally