public class Source{
public void method1(){
System.out.println("this is a method1");
}
}
public interface Targetable{
public void method1();
public void method2();
}
public class Wrapper implemenets Targetable{
private Source source;
public Targetable(Source source){
this.source = source
}
@Override
public void method1(){
System.out.println("this is original method1");
}
@Override
public void method2(){
System.out.println("this is the method2");
}
}
public class TestWrapper{
public static void main(){
Source source = new Source();
Targetable targeable = new Wrapper(source);
targetable.method1();
targetable.method2();
}
}