"ramakrishna" wrote...
> can any one tell me, why NoSuchMethodException will come in
> Class.getConstructor( Class[] parameterTypes) method.
Your code snippets are just a tab too short to give a complete answer.
Whn you say that "NoSuchMethodException will come", do you mean as a
compilation error or as a runtime error.
As getConstructor *can* throw a NoSuchMethodException, you need to wrap it
in a try-catch-clause.
If you have done that, and you get it as a runtime error, you need to
provide a bit more code.
> In my program Iam using the one constructor and iam calling the
> constructor by passing array of class object
[quoted text clipped - 7 lines]
> GetAuthorisedUnauthorisedRecordsAction gauUnau = new
> GetAuthorisedUnauthorisedRecordsAction();
Is GetAuthorisedUnauthorisedRecordsAction a subtype of something else?
If the constructor of ActionHelper takes a supertype of
GetAuthorisedUnauthorisedRecordsAction, the constructor itself will work
when used in an ordinary manner...
> com.citibank.treasuryintegration.ui.action.ActionHelper actionHelper
> = new com.citibank.treasuryintegration.ui.action.ActionHelper( gauUnau
> );
...but it will not correspond to the signature of the constructor:
> Class[] tParameterClasses = new Class[1];
> tParameterClasses[0] = gauUnau.getClass();
> Constructor tConstructor =
> tClass.getConstructor(tParameterClasses);
So, if ActionHelper actually expects a supertype of
GetAuthorisedUnauthorisedRecordsAction, you'll get a NoSuchMethodException,
because GetAuthorisedUnauthorisedRecordsAction is not a parameter in the
constructor's signature.
// Bjorn A