/sitebricks-acceptance-tests/src/main/java/com/google/sitebricks/example/Repeat.java

http://github.com/dhanji/sitebricks · Java · 31 lines · 18 code · 7 blank · 6 comment · 0 complexity · 95dcec895383506da65e636873d1bb4e MD5 · raw file

  1. package com.google.sitebricks.example;
  2. import com.google.sitebricks.At;
  3. import java.util.*;
  4. /**
  5. * @author Dhanji R. Prasanna (dhanji@gmail.com)
  6. */
  7. @At("/repeat")
  8. public class Repeat {
  9. private static final List<String> NAMES = Arrays.asList("Dhanji", "Josh", "Jody", "Iron Man");
  10. //property returns a list of names
  11. public List<String> getNames() {
  12. return NAMES;
  13. }
  14. //try a set this time, returns movies (to demo nested repeat)
  15. public Set<Movie> getMovies() {
  16. return new HashSet<Movie>(Arrays.asList(new Movie(), new Movie(), new Movie()));
  17. }
  18. public static class Movie {
  19. //try a collection this time. same as property Repeat.getNames() from the outer class
  20. public Collection<String> getActors() {
  21. return NAMES;
  22. }
  23. }
  24. }