Created
February 9, 2011 02:22
-
-
Save josedonizetti/817769 to your computer and use it in GitHub Desktop.
Database.java used at the restfulie-java one minute tutorial.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Database { | |
private final List<Item> items; | |
public Database(){ | |
items = new ArrayList<Item>(); | |
items.add(createItem(1,"restfulie-book", 25.00)); | |
items.add(createItem(2,"restf in practice", 35.00)); | |
} | |
public List<Item> getItems(){ | |
return items; | |
} | |
public Item getItem(Integer id){ | |
return items.get(id - 1); | |
} | |
private Item createItem(Integer id, String name, Double price){ | |
return new Item(id,name,price); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment