World.java 787 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package hello.home.entity;
  2. import com.techempower.js.*;
  3. import hello.*;
  4. /**
  5. * Simple World entity.
  6. */
  7. public class World
  8. extends GhDataEntity
  9. {
  10. private int randomNumber;
  11. /**
  12. * Set the random number.
  13. */
  14. public void setRandomNumber(int randomNumber)
  15. {
  16. this.randomNumber = randomNumber;
  17. }
  18. /**
  19. * Get the random number.
  20. */
  21. public int getRandomNumber()
  22. {
  23. return this.randomNumber;
  24. }
  25. /**
  26. * A visitor factory used to map this class to JSON.
  27. */
  28. public static final VisitorFactory<World> VISITOR_FACTORY = new VisitorFactory<World>()
  29. {
  30. @Override
  31. public Visitor visitor(World world)
  32. {
  33. return Visitors.map(
  34. "id", world.getId(),
  35. "randomNumber", world.getRandomNumber());
  36. }
  37. };
  38. }