본문 바로가기
[Java] Reflection Tutorial - Dynamic Proxies Java, Reflection Tutorial - Dynamic Proxies reflection 을 이용하여 runtime에 interface 를 구현할 수도 있다.다시 말해 proxy를 사용하기 위해서는 구현하고자 하는 interface가 꼭 있어야 한다. 보통 interface 를 구현하는 방법은 다음과 같이 2가지가 있다. public class FooImpl implmenets FooInterface{@Overridepublic void test(){// do sth...}} new FooImpl{@Overridepublic void test(){// do sth...}} proxy 는 자주 사용되지는 않지만 특별한 경우에 사용하는 세번째 방법이라고 보면 된다. FooInterface foo =.. 2014. 1. 3.
[Java] Reflection Tutorial - Method Java, Reflection Tutorial - Method Obtaining Method Objects Method[] methods = aClass.getMethods(); // only public methodsMethod method = aClass.getMethod( "methodName", Class[]{ String.class} ); getMethod 함수는 NoSuchMethodException 을 throw 할 수 있음 no parameter case 는 Class[] 부분에 null 을 입력. Method Parameters and Return Types. Class[] parameterTypes = method.getParameterTypes();Class returnType = m.. 2013. 11. 28.
[JavaScript/Tutorial] this 란 무엇인가? this 가 가르키는 건 무엇인가? 주의사항은? this 란 무엇인가? this 가 가르키는 건 무엇인가? 주의사항은? [이전강좌] typeof 사용시의 주의사항, array type 판별코드. this 란 무엇인가? this 키워드는, 해당 function 을 invoke 한 object 를 가르키는 데 사용된다. this 가 가르키는 것은 어떻게 판별하는가? 1. Function.call 이나 Function.apply 를 통해 function call 을 하게 되면, call() 이나 apply() 의 첫번쨰 argument 가 this 가 된다. 만약 Function.call 이나 Function,apply 의 첫번째 argument 로 null 이나 undefined 가 들어왔다면 this는 global object 를 참조한다. 2. 만약 .. 2013. 5. 24.
반응형