View Javadoc

1   package com.atlassian.plugins.rest.sample.expansion.entity;
2   
3   import com.atlassian.plugins.rest.common.expand.AbstractRecursiveEntityExpander;
4   import com.atlassian.plugins.rest.sample.expansion.resource.DataStore;
5   
6   /**
7    * Expands a {com.atlassian.plugins.rest.sample.expansion.entity.SubRecord} by asking the {@link com.atlassian.plugins.rest.sample.expansion.resource.DataStore} to perform the database queries (fake).
8    */
9   public class SubRecordExpander extends AbstractRecursiveEntityExpander<SubRecord> {
10      protected SubRecord expandInternal(SubRecord entity) {
11          if (entity != null && entity.getPlayerRecord() != null) {
12              return DataStore.getInstance().getSubRecord(entity.getPlayerRecord());
13          }
14          return entity;
15      }
16  }