Skip to content

Instantly share code, notes, and snippets.

@rohman
Last active December 16, 2015 00:49
Show Gist options
  • Save rohman/5350317 to your computer and use it in GitHub Desktop.
Save rohman/5350317 to your computer and use it in GitHub Desktop.
Ulang Spring mvc
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package id.web.rohman.ulangspring.service.impl;
import id.web.rohman.ulangspring.model.Tamu;
import id.web.rohman.ulangspring.service.api.TamuService;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
/**
*
* @author syahril
*/
@Service
public class TamuServiceImpl implements TamuService{
private List<Tamu> dbPalsu = new ArrayList<Tamu>();
public TamuServiceImpl() {
Tamu t = new Tamu();
t.setName("Ariel");
t.setAddress("Jakarta");
t.setEmail("[email protected]");
t.setId(dbPalsu.size());
dbPalsu.add(t);
Tamu t2 = new Tamu();
t2.setName("rohman");
t2.setAddress("Bandung");
t2.setEmail("[email protected]");
t2.setId(dbPalsu.size());
dbPalsu.add(t2);
}
public List<Tamu> listTamu() {
return dbPalsu;
}
public Tamu findTamuById(Integer id) {
return dbPalsu.get(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment