Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1034937 // handleObjectMethodsInProxyInvocationHandler

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5105L/28K).

sO handleObjectMethodsInProxyInvocationHandler(
  O invocationHandler,
  Method implementedMethod,
  Method method,
  O proxy,
  O[] actualArgs) {
  S name = method.getName();
  
  if (name.equals("hashCode"))
    ret invocationHandler.hashCode();
  if (name.equals("equals"))
    ret proxy == actualArgs[0];
  if (name.equals("toString"))
    ret invocationHandler.toString();
    
  fail("No handler for method " + method + " (only have " + implementedMethod + ")");
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034937
Snippet name: handleObjectMethodsInProxyInvocationHandler
Eternal ID of this version: #1034937/2
Text MD5: 3ca24a9db69a958b36d337a3b134ce3c
Transpilation MD5: 5835f100e88c504a289e7952e01e4847
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-16 18:34:26
Source code size: 486 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 150 / 209
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)