checkNotNull(context, "context cannot be null");
if (!type.isInterface()) {
return null;
}
final Factory factory = (Factory) context.get(Factory.class);
if (factory == null) {
return null;
}
if (hasPathAnnotation(type)) {
return factory.build(type);
}
for (final Method method : type.getMethods()) {
if (method.getAnnotation(Path.class) != null) {
return factory.build(type);
}
}
return null;
}