Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve:ProviderMethodModel add parameterClasses #3693

Merged
merged 1 commit into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@
package org.apache.dubbo.rpc.model;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class ProviderMethodModel {
private final Method method;
private final String methodName;
private final Class<?>[] parameterClasses;
private final String[] methodArgTypes;

private final Type[] genericParameterTypes;
private final ConcurrentMap<String, Object> attributeMap = new ConcurrentHashMap<>();

public ProviderMethodModel(Method method) {
this.method = method;
this.methodName = method.getName();
this.parameterClasses = method.getParameterTypes();
this.methodArgTypes = getArgTypes(method);
this.genericParameterTypes = method.getGenericParameterTypes();
}

public Method getMethod() {
Expand Down Expand Up @@ -61,4 +65,12 @@ private static String[] getArgTypes(Method method) {
}
return methodArgTypes;
}

public Class<?>[] getParameterClasses() {
return parameterClasses;
}

public Type[] getGenericParameterTypes() {
return genericParameterTypes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public ProviderMethodModel getMethodModel(String methodName, String[] argTypes)
return null;
}

public List<ProviderMethodModel> getMethodModelList(String methodName) {
return methods.get(methodName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may return null value, are you expecting that? Typically when you want to return a List, user will expect an empty list rather than null.

}


private void initMethod(Class<?> serviceInterfaceClass) {
Method[] methodsToExport = null;
methodsToExport = serviceInterfaceClass.getMethods();
Expand Down