Re: Instance java.lang.Object.getClass() of Class Java Method on OO Tumia
On 6 feb, 10:50, Lew <lewbl...@gmail.com> wrote:
Paka Small wrote:
You write "> Statement A, as you call it, was an objection to your
blatant misrepresentation
that methods are classes, and a fair one.". Nowhere and never I have s=
tated
that methods are classes. Please have the decency not to put words in =
my mouth!
You put these words in your own mouth: "My statement (a method is also a =
class
which has method instances) is proven by the Oracle Java link above and b=
acked
up with 20 years of professional software development experience."
I did not lack decency. I was merely stating a fact. That was your statem=
ent,
and it is not true.
You also said: "Please can you pinpoint where in this document is written=
that
a Java method is not an instance of the class Method." Not true.
You also excoriated Daniel's post, saying, "you put out with such vigour =
your
statement ('Those aren't instances, they are called methods.') that is to=
tally
incorrect." Not true.
You put these statements forward. I copied and pasted them into this post=
.. I
did not make them up. You said them.
How strange that you now deny saying them. Still, they're a matter of pub=
lic
record so there's no denying responsibility.
--
Lew
Hi,
Example code proving beyond any doubt that a method is an instance of
the class java.lang.reflect.Method in Java:
public final void setValue(BaseObject baseObject, Object value) {
java.lang.reflect.Method setMethod = null;
try {
setMethod =
baseObjectClass.getJavaClass().getMethod(this.getSetMethodName(), new
Class[]{this.type});
} catch (NoSuchMethodException ex) {
Logger.getLogger(BaseObjectAttribute.class.getName()).log(Level.SEVERE,
null, ex);
} catch (SecurityException ex) {
Logger.getLogger(BaseObjectAttribute.class.getName()).log(Level.SEVERE,
null, ex);
}
try {
setMethod.invoke(baseObject, new Object[]{value});
} catch (IllegalAccessException ex) {
Logger.getLogger(BaseObjectAttribute.class.getName()).log(Level.SEVERE,
null, ex);
} catch (IllegalArgumentException ex) {
Logger.getLogger(BaseObjectAttribute.class.getName()).log(Level.SEVERE,
null, ex);
} catch (InvocationTargetException ex) {
Logger.getLogger(BaseObjectAttribute.class.getName()).log(Level.SEVERE,
null, ex);
}
}
Kind regards, Paka