Advertisement
Guest User

Untitled

a guest
May 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public final class MyModelAdapter {
  2.     private OnConnectionReady onConnectionReady;
  3.  
  4.     public MyModelAdapter setOnConnectionReady(OnConnectionReady connection) {
  5.         this.onConnectionReady = connection;
  6.         return this;
  7.     }
  8.  
  9.     public interface OnConnectionReady {
  10.         void onConnect(String message);
  11.     }
  12.  
  13.     //more stuff..
  14. }
  15.  
  16. public final class MyModel {
  17.     private MyModelAdapter adapter;
  18.  
  19.     public void do() {
  20.         adapter.setOnConnectionReady(this::whenAdapterIsConnected);
  21.     }
  22.  
  23.     public void whenAdapterIsConnected(String message) {
  24.         //make fun
  25.     }      
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement