Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import com.amadornes.jtraits.JTrait;
  2. import com.amadornes.jtraits.MixinFactory;
  3.  
  4. public class Test {
  5.  
  6. public static void main(String[] args) throws IllegalAccessException, InstantiationException {
  7. Base base = new Base();
  8. base.hello();
  9.  
  10. Class<? extends Base> newBase = MixinFactory.mixin(Base.class, BaseOverride.class);
  11. newBase.newInstance().hello();
  12. }
  13.  
  14. static class Base {
  15. public void hello() {
  16. System.out.println("hello from the base");
  17. }
  18. }
  19.  
  20. static class BaseOverride extends JTrait<Base> {
  21. public void hello() {
  22. System.out.println("hi from the base");
  23. }
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement