Package nolza_g1.javatutorials.overriding.example1

Examples of nolza_g1.javatutorials.overriding.example1.Calculator


//class B is in different package with A
//therefore B cannot use A class
public class B {

  public static void main(String[] args) {
    A a = new A();

  }
View Full Code Here


      {IsLocalProxyFactoryInterceptor.singleton, new NotToBeInvokedInterceptor()};
      PojiProxy handler = new PojiProxy(KEY, null, interceptors);
      Class<?>[] interfaces = new Class<?>[]
      {Calculator.class};
      // create the proxy
      Calculator calculator = (Calculator) Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, handler);
      // register with dispatcher too, since the IsLocalProxyFactoryInterceptor
      // looks for the key in the dispatcher
      Dispatcher.singleton.registerTarget(KEY, new CalculatorImpl());

      try
      {
         int result = calculator.add(1, 2);
         logger.info("Successfully invoked method. Result = " + result);
         Assert.assertEquals("Incorrect result from calculator", result, 3);
      }
      catch (IllegalInvocationException iie)
      {
View Full Code Here

TOP

Related Classes of nolza_g1.javatutorials.overriding.example1.Calculator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.