Expose interface methods names
I'm working in a method that invoke a class method using reflection and
getting my service object class from spring. Something like this:
private void InvokeMethod(string serviceName, string methodName, params
object[] arguments)
{
object service =
SpringContextManager.Instance.GetObject(serviceName);
Type classType = service.GetType();
MethodInfo method = classType.GetMethod(methodName);
method.Invoke(service, arguments);
}
//...
InvokeMethod(SpringObjectsConstants.LogDocumentService,
"SetDocumentStatus", 9127, LogDocumentPendingStatusEnum.Finalized)
I need to inform the method name as a string so the method can call it,
but I dont want to work with strings because if the method name changes, I
can´t track the usages of it. There is any way to work with the interfaces
methods that look like an enum or something? Anything that could cause
compilation errors or I can update renaming the method name in visual
studio?
No comments:
Post a Comment