World.java 820 B

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