Skip to content

Instantly share code, notes, and snippets.

@an-sangkil
Last active August 29, 2015 14:13
Show Gist options
  • Save an-sangkil/63d227a834c4dda7c13c to your computer and use it in GitHub Desktop.
Save an-sangkil/63d227a834c4dda7c13c to your computer and use it in GitHub Desktop.
Custom Listener
package com.listener.test1;
/**
* <pre>
* Class Name : ListenerTest1.java
* Description :
* Modification Information
*
* 수정일       수정자    수정내용
* ──────────── ───────── ───────────────────────────────
* 2015. 1. 15. ask 최초생성
* </pre>
*
* @author ask
* @since 2015. 1. 15.
* @version
*
* Copyright (C) 2014 by SKAN.COMPANY All right reserved.
*/
public interface IListenerTest {
public void startListener () ;
public void runListener (int countNumber) ;
}
class InitListener {
private IListenerTest listenerInterface ;
public InitListener(IListenerTest listenerInterface ) {
this.listenerInterface = listenerInterface;
listenerInterface.startListener();
}
public void methodCall () {
for (int i = 0 ; i < 100 ; i ++) {
listenerInterface.runListener(i );
}
}
}
class Responder implements IListenerTest {
public void listenerTest() {
InitListener inL = new InitListener(this);
inL.methodCall();
}
@Override
public void startListener() {
System. out.println("Listener Call !" );
}
@Override
public void runListener(int countNumber) {
System. out.println(countNumber );
}
}
class ListenerTest {
public static void main(String ...arg) throws Exception {
Responder r = new Responder();
r.listenerTest();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment