View Javadoc

1   package com.atlassian.plugins.rest.common.expand;
2   
3   import com.atlassian.plugins.rest.common.expand.resolver.EntityExpanderResolver;
4   
5   public abstract class AbstractRecursiveEntityExpander<T> implements EntityExpander<T>
6   {
7       public final T expand(ExpandContext<T> context, EntityExpanderResolver expanderResolver, EntityCrawler entityCrawler)
8       {
9           final T expandedEntity = expandInternal(context.getEntity());
10          if (!context.getEntityExpandParameter().isEmpty())
11          {
12              entityCrawler.crawl(expandedEntity, context.getEntityExpandParameter().getExpandParameter(context.getExpandable()), expanderResolver);
13          }
14          return expandedEntity;
15      }
16  
17      protected abstract T expandInternal(T entity);
18  }