๋ฐ์ํ
์ฃผ๋ฌธ๋ฒํธ๋ฅผ ๋งค๊ฐ๋ณ์๋ก ๊ฐ๋ Order ํด๋์ค์ canCancel ๋ฉ์๋๊ฐ private๋ก ์ ์ธ๋์ด ์์ ๋
์ด ๋ฉ์๋๋ฅผ ์ธ๋ถ์์ ํธ์ถํ๋ ๋ฐฉ๋ฒ์ ์๋์ ๊ฐ๋ค.
Order order = new Order();
Method method = order.getClass().getDeclaredMethod("canCancel", Order.class);
method.setAccessible(true);
boolean result = (boolean)method.invoke(order, "์ฃผ๋ฌธ๋ฒํธ");
728x90
๋ฐ์ํ
'๊ฐ๋ฐ > JAVA' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JAVA] ๋ฐฐ์น(bat), ์(sh) ์คํํ๊ธฐ (1) | 2022.05.18 |
---|---|
[JAVA] KeyStore์ Root ์ธ์ฆ์ ๋ฑ๋กํ๊ธฐ(SSLHandshakeException, PKIXException) (1) | 2022.05.18 |
[JAVA] Runnable ๊ณผ Thread์ ์ฐจ์ด (0) | 2022.05.16 |
[JAVA] ๋น๋๊ธฐ ์ฒ๋ฆฌ ๋ฐฉ๋ฒ - Thread (0) | 2022.04.27 |
[JAVA] java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.error(Ljava/lang/String;Ljava/lang/Object;)V] (0) | 2022.03.25 |
๋๊ธ