View Javadoc

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