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 * Tells whether this resolver can get an expander for the given instance.
11 *
12 * @param type the type to resolve the expander for.
13 * @return {@code true} if an expander can be found for this object instance, {@code false} otherwise.
14 */
15 boolean hasExpander(Class<?> type);
16
17 /**
18 * Gets an {@link EntityExpander} for the given type.
19 *
20 * @param type the type of object to look up the expander for.
21 * @param <T> the type of object to retrieve the expander for.
22 * @return the EntityExpander, {@code null} if none could be found. This method will never return {@code null} if
23 * {@link #hasExpander(Class)} returns {@code true} for the same instance.
24 */
25 <T> EntityExpander<T> getExpander(Class<? extends T> type);
26 }