com.iwbfly.myhttp.lifecycles.param.VariableLifeCycle Maven / Gradle / Ivy
The newest version!
package com.iwbfly.myhttp.lifecycles.param;
import com.iwbfly.myhttp.annotation.Variable;
import com.iwbfly.myhttp.lifecycles.ParameterAnnotationLifeCycle;
import com.iwbfly.myhttp.mapping.MappingParameter;
import com.iwbfly.myhttp.mapping.MappingVariable;
import com.iwbfly.myhttp.reflection.MyhttpMethod;
import com.iwbfly.myhttp.utils.StringUtils;
/**
* @author pangyajun
* @since 2021/12/2 11:58
**/
public class VariableLifeCycle implements ParameterAnnotationLifeCycle {
@Override
public void onParameterInitialized(MyhttpMethod method, MappingParameter parameter, Variable annotation) {
String name = annotation.value();
if (StringUtils.isEmpty(name)) {
name = parameter.getName();
}
MappingVariable variable = new MappingVariable(name, parameter.getType());
variable.setIndex(parameter.getIndex());
method.addVariable(name, variable);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy