33 lines
788 B
TypeScript
33 lines
788 B
TypeScript
import { Method } from '../reflect';
|
|
|
|
export abstract class ReflectionUtil {
|
|
public static getParamTypes(method: Method): any[] {
|
|
if (0 === method.getParameterCount()) {
|
|
return [];
|
|
}
|
|
|
|
const parameters = method.getParameters();
|
|
if (undefined === parameters) {
|
|
return [];
|
|
}
|
|
const results: any[] = [];
|
|
for (let indexI = 0; indexI < parameters.length; indexI++) {
|
|
const paramType = parameters[indexI].getType();
|
|
results.push(paramType);
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
public static getParamTypeStrings(method: Method): string[] {
|
|
const paramTypes = ReflectionUtil.getParamTypes(method);
|
|
|
|
const results: string[] = [];
|
|
paramTypes.forEach(paramType => {
|
|
results.push(paramType.name);
|
|
});
|
|
|
|
return results;
|
|
}
|
|
}
|