package feign.hystrix;

import static feign.Util.resolveLastTypeParameter;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;

import com.netflix.hystrix.HystrixCommand;

import feign.Contract;
import feign.MethodMetadata;

final class HystrixDelegatingContract implements Contract {

  private final Contract delegate;

  public HystrixDelegatingContract(Contract delegate) {
    this.delegate = delegate;
  }

  @Override
  public List<MethodMetadata> parseAndValidatateMetadata(Class<?> targetType) {
    List<MethodMetadata> metadatas = this.delegate.parseAndValidatateMetadata(targetType);

    for (MethodMetadata metadata : metadatas) {
      Type type = metadata.returnType();

      if (type instanceof ParameterizedType && ((ParameterizedType) type).getRawType().equals(HystrixCommand.class)) {
        Type actualType = resolveLastTypeParameter(type, HystrixCommand.class);
        metadata.returnType(actualType);
      }
    }

    return metadatas;
  }
}

@@ -265,16 +265,271 @@
 adata;%0A%0A
+/**%0A * This special cases methods that return %7B@link HystrixCommand%7D, so that they%0A * are decoded properly.%0A * %0A * %3Cp%3EFor example, %7B@literal HystrixCommand%3CFoo%3E%7D will decode %7B@code Foo%7D.%0A */%0A// Visible for use in custom Hystrix invocation handlers%0Apublic 
 final cl

Document and expose HystrixDelegatingContract