View Javadoc

1   package com.atlassian.plugins.rest.sample.expansion.entity;
2   
3   import com.atlassian.plugins.rest.common.expand.Expander;
4   
5   import static javax.xml.bind.annotation.XmlAccessType.FIELD;
6   import javax.xml.bind.annotation.XmlAccessorType;
7   import javax.xml.bind.annotation.XmlElement;
8   import javax.xml.bind.annotation.XmlRootElement;
9   import javax.xml.bind.annotation.XmlTransient;
10  
11  /**
12   * The total points scoring record for a player.
13   */
14  @XmlRootElement
15  @XmlAccessorType(FIELD)
16  @Expander(PlayerRecordExpander.class)
17  public class PlayerRecord
18  {
19      /**
20       * Creates an empty record which is used to inform the client that a record is available without
21       * performing the cost of calculating it.  If the client requires the record it can expand this field.
22       *
23       * @param player
24       * @return
25       */
26      public static PlayerRecord emptyRecord(Player player)
27      {
28          return new PlayerRecord(player);
29      }
30  
31      @XmlElement
32      private Integer pointsScored;
33  
34      @XmlTransient
35      private Player player;
36  
37      public PlayerRecord()
38      {
39      }
40  
41      public PlayerRecord(Player player)
42      {
43          this.player = player;
44      }
45  
46      public PlayerRecord(int pointsScored)
47      {
48          this.pointsScored = pointsScored;
49      }
50  
51      public Integer getPointsScored()
52      {
53          return pointsScored;
54      }
55  
56      public void setPointsScored(Integer pointsScored)
57      {
58          this.pointsScored = pointsScored;
59      }
60  
61      public Player getPlayer()
62      {
63          return player;
64      }
65  }