1 package com.atlassian.plugins.rest.common.expand.resolver;
2
3 import com.atlassian.plugins.rest.common.expand.EntityExpander;
4
5 /**
6 * <p>A resolver to find the expander for object or types.</p>
7 */
8 public interface EntityExpanderResolver
9 {
10 /**
11 * Tells whether this resolver can get an expander for the given instance.
12 *
13 * @param type the type to resolve the expander for.
14 * @return {@code true} if an expander can be found for this object instance, {@code false} otherwise.
15 */
16 boolean hasExpander(Class<?> type);
17
18 /**
19 * Gets an {@link EntityExpander} for the given type.
20 *
21 * @param type the type of object to look up the expander for.
22 * @param <T> the type of object to retrieve the expander for.
23 * @return the EntityExpander, {@code null} if none could be found. This method will never return {@code null} if
24 * {@link #hasExpander(Class)} returns {@code true} for the same instance.
25 */
26 <T> EntityExpander<T> getExpander(Class<? extends T> type);
27 }