美文网首页
2018-05-07

2018-05-07

作者: Alenenly | 来源:发表于2018-05-07 22:50 被阅读0次

import java.lang.reflect.InvocationHandler;

import java.lang.reflect.Method;

import java.lang.reflect.Proxy;

import java.lang.reflect.UndeclaredThrowableException;

import model.proxy.ICoder;

public final class TestProxyGen extends Proxy

  implements ICoder

{

  private static Method m1;

  private static Method m0;

  private static Method m3;

  private static Method m2;

  public TestProxyGen(InvocationHandler paramInvocationHandler)

    throws

  {

    super(paramInvocationHandler);

  }

  public final boolean equals(Object paramObject)

    throws

  {

    try

    {

      return ((Boolean)this.h.invoke(this, m1, new Object[] { paramObject })).booleanValue();

    }

    catch (RuntimeException localRuntimeException)

    {

      throw localRuntimeException;

    }

    catch (Throwable localThrowable)

    {

    }

    throw new UndeclaredThrowableException(localThrowable);

  }

  public final int hashCode()

    throws

  {

    try

    {

      return ((Integer)this.h.invoke(this, m0, null)).intValue();

    }

    catch (RuntimeException localRuntimeException)

    {

      throw localRuntimeException;

    }

    catch (Throwable localThrowable)

    {

    }

    throw new UndeclaredThrowableException(localThrowable);

  }

  public final void implDemands(String paramString)

    throws

  {

    try

    {

      this.h.invoke(this, m3, new Object[] { paramString });

      return;

    }

    catch (RuntimeException localRuntimeException)

    {

      throw localRuntimeException;

    }

    catch (Throwable localThrowable)

    {

    }

    throw new UndeclaredThrowableException(localThrowable);

  }

  public final String toString()

    throws

  {

    try

    {

      return (String)this.h.invoke(this, m2, null);

    }

    catch (RuntimeException localRuntimeException)

    {

      throw localRuntimeException;

    }

    catch (Throwable localThrowable)

    {

    }

    throw new UndeclaredThrowableException(localThrowable);

  }

  static

  {

    try

    {

      m1 = Class.forName("java.lang.Object").getMethod("equals", new Class[] { Class.forName("java.lang.Object") });

      m0 = Class.forName("java.lang.Object").getMethod("hashCode", new Class[0]);

      m3 = Class.forName("model.proxy.ICoder").getMethod("implDemands", new Class[] { Class.forName("java.lang.String") });

      m2 = Class.forName("java.lang.Object").getMethod("toString", new Class[0]);

      return;

    }

    catch (NoSuchMethodException localNoSuchMethodException)

    {

      throw new NoSuchMethodError(localNoSuchMethodException.getMessage());

    }

    catch (ClassNotFoundException localClassNotFoundException)

    {

    }

    throw new NoClassDefFoundError(localClassNotFoundException.getMessage());

  }

}

相关文章

网友评论

      本文标题:2018-05-07

      本文链接:https://www.haomeiwen.com/subject/rgubrftx.html