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

com.gitee.feizns.convert.method.valueof.MethodSelectionStrategyByParameterOneImpl Maven / Gradle / Ivy

There is a newer version: 6.3-RELEASE
Show newest version
package com.gitee.feizns.convert.method.valueof;

import com.gitee.feizns.convert.method.MethodWrapper;
import com.gitee.feizns.reflect.MethodUtils;
import com.gitee.feizns.reflect.TypeUtils;

import java.lang.reflect.Method;

/**
 * 根据方法的第一参数最优匹配选择最优的方法
 * @author feizns
 * @since 2019/6/15 0015
 */
public class MethodSelectionStrategyByParameterOneImpl extends AbstractMethodSelectionStrategyByParameter {

    @Override
    protected boolean isYou(Method method, Class inheritanceClz) {
        return TypeUtils.getWrapper(method.getParameterTypes()[0]) == inheritanceClz;
    }

    @Override
    protected MethodWrapper getInvokeStrategy(Method method, Class targetType, Object original) {
        return () -> method == null ? null : MethodUtils.invoke(method, original);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy