Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.amadornes.jtraits.JTrait;
- import com.amadornes.jtraits.MixinFactory;
- public class Test {
- public static void main(String[] args) throws IllegalAccessException, InstantiationException {
- Base base = new Base();
- base.hello();
- Class<? extends Base> newBase = MixinFactory.mixin(Base.class, BaseOverride.class);
- newBase.newInstance().hello();
- }
- static class Base {
- public void hello() {
- System.out.println("hello from the base");
- }
- }
- static class BaseOverride extends JTrait<Base> {
- public void hello() {
- System.out.println("hi from the base");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement