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 {@link PlayerRecord} by asking the {@link DataStore} to perform the database queries.
8    */
9   public class PlayerRecordExpander extends AbstractRecursiveEntityExpander<PlayerRecord>
10  {
11      protected PlayerRecord expandInternal(PlayerRecord entity)
12      {
13          if (entity!=null && entity.getPlayer() != null)
14              return DataStore.getInstance().getPlayerRecord(entity.getPlayer());
15          else
16              return entity;
17      }
18  }