All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.linyuzai.dynamicfeign.targeter.FakeTargeter Maven / Gradle / Ivy

There is a newer version: 0.4.0
Show newest version
package com.github.linyuzai.dynamicfeign.targeter;

public class FakeTargeter {

    private static DefaultTargeter defaultTargeter = new DefaultTargeter();
    private static HystrixTargeter hystrixTargeter = new HystrixTargeter();

    @SuppressWarnings("unchecked")
    public static  T fake(Object real) {
        if (real.getClass().getName().equals("org.springframework.cloud.openfeign.DefaultTargeter")) {
            return (T) defaultTargeter;
        } else if (real.getClass().getName().equals("org.springframework.cloud.openfeign.HystrixTargeter")) {
            return (T) hystrixTargeter;
        } else {
            throw new RuntimeException("FakeTargeter[" + real.getClass().getName() + "] not matched");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy