avatar
a question on interface# Java - 爪哇娇娃
c*i
1
(1) Nellie S. Huang, The King of Stamps in China. China Real Time, Sept. 10,
2010.
http://blogs.wsj.com/chinarealtime/2010/09/10/the-king-of-stamps-in-china/
My comment:
(a) 1980年中國猴年八分郵票
(b) "Small One Dollar" stamp 1897年清朝「紅印花3分加蓋改值小字當壹圓」郵票
(小壹圓加蓋票 for short)
The stamp shown in this report--and to be auctioned--is SMALL One Dollar.
The difference between Small One Dollar 小壹圓加蓋票 and Large One Dollar 大
壹圓加蓋票 is the size of characters 當壹圓 ONLY. "大清郵政" above and "1
dollar" below were of the same
avatar
P*P
2
我有一个interface定义了一个method A,两个class implements了这个interface,meth
od A.如果另一个class要调用这个method A,怎么制定要用哪个implementation呢.谢谢
avatar
g*g
3
是那个类的实例就会用那个。

meth

【在 P*P 的大作中提到】
: 我有一个interface定义了一个method A,两个class implements了这个interface,meth
: od A.如果另一个class要调用这个method A,怎么制定要用哪个implementation呢.谢谢

avatar
w*r
4
instanceof(o).getMethod("methodname").invoke(o,...)

meth

【在 P*P 的大作中提到】
: 我有一个interface定义了一个method A,两个class implements了这个interface,meth
: od A.如果另一个class要调用这个method A,怎么制定要用哪个implementation呢.谢谢

avatar
h*o
5
That is quite a fancy call.

【在 w*r 的大作中提到】
: instanceof(o).getMethod("methodname").invoke(o,...)
:
: meth

avatar
w*r
6
so far this is the standard way to figure out which method you are hitting.
And it is the basic methodology deployed by spring

【在 h*********o 的大作中提到】
: That is quite a fancy call.
avatar
h*o
7
first, I do not see reflective invocation has anything to do with the
original question. maybe I do not see things deep enough.
second, getmethod is a method belongs to class metadata, you can not call it
on an object instance , nor on instanceof operator.
third, getmethod(String) only returns method object. If you can somehow to
figure out which class metadata to use, you already answer the question, no
need to make the function call using reflection.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。