Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 java.management.jmod - Management Module
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module.
JDK 11 Management module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.management.jmod.
JDK 11 Management module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Management module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.management.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ javax/management/openmbean/CompositeDataInvocationHandler.java
/* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.management.openmbean; import com.sun.jmx.mbeanserver.MXBeanLookup; import com.sun.jmx.mbeanserver.MXBeanMapping; import com.sun.jmx.mbeanserver.MXBeanMappingFactory; import com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** <p>An {@link InvocationHandler} that forwards getter methods to a {@link CompositeData}. If you have an interface that contains only getter methods (such as {@code String getName()} or {@code boolean isActive()}) then you can use this class in conjunction with the {@link Proxy} class to produce an implementation of the interface where each getter returns the value of the corresponding item in a {@code CompositeData}.</p> <p>For example, suppose you have an interface like this: <blockquote> <pre> public interface NamedNumber { public int getNumber(); public String getName(); } </pre> </blockquote> and a {@code CompositeData} constructed like this: <blockquote> <pre> CompositeData cd = new {@link CompositeDataSupport}( someCompositeType, new String[] {"number", "name"}, new Object[] {<b>5</b>, "five"} ); </pre> </blockquote> then you can construct an object implementing {@code NamedNumber} and backed by the object {@code cd} like this: <blockquote> <pre> InvocationHandler handler = new CompositeDataInvocationHandler(cd); NamedNumber nn = (NamedNumber) Proxy.newProxyInstance(NamedNumber.class.getClassLoader(), new Class[] {NamedNumber.class}, handler); </pre> </blockquote> A call to {@code nn.getNumber()} will then return <b>5</b>. <p>If the first letter of the property defined by a getter is a capital, then this handler will look first for an item in the {@code CompositeData} beginning with a capital, then, if that is not found, for an item beginning with the corresponding lowercase letter or code point. For a getter called {@code getNumber()}, the handler will first look for an item called {@code Number}, then for {@code number}. If the getter is called {@code getnumber()}, then the item must be called {@code number}.</p> <p>If the method given to {@link #invoke invoke} is the method {@code boolean equals(Object)} inherited from {@code Object}, then it will return true if and only if the argument is a {@code Proxy} whose {@code InvocationHandler} is also a {@code CompositeDataInvocationHandler} and whose backing {@code CompositeData} is equal (not necessarily identical) to this object's. If the method given to {@code invoke} is the method {@code int hashCode()} inherited from {@code Object}, then it will return a value that is consistent with this definition of {@code equals}: if two objects are equal according to {@code equals}, then they will have the same {@code hashCode}.</p> @since 1.6 */ public class CompositeDataInvocationHandler implements InvocationHandler { /** <p>Construct a handler backed by the given {@code CompositeData}.</p> @param compositeData the {@code CompositeData} that will supply information to getters. @throws IllegalArgumentException if {@code compositeData} is null. */ public CompositeDataInvocationHandler(CompositeData compositeData) { this(compositeData, null); } /** <p>Construct a handler backed by the given {@code CompositeData}.</p> @param compositeData the {@code CompositeData} that will supply information to getters. @throws IllegalArgumentException if {@code compositeData} is null. */ CompositeDataInvocationHandler(CompositeData compositeData, MXBeanLookup lookup) { if (compositeData == null) throw new IllegalArgumentException("compositeData"); this.compositeData = compositeData; this.lookup = lookup; } /** Return the {@code CompositeData} that was supplied to the constructor. @return the {@code CompositeData} that this handler is backed by. This is never null. */ public CompositeData getCompositeData() { assert compositeData != null; return compositeData; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); // Handle the methods from java.lang.Object if (method.getDeclaringClass() == Object.class) { if (methodName.equals("toString") && args == null) return "Proxy[" + compositeData + "]"; else if (methodName.equals("hashCode") && args == null) return compositeData.hashCode() + 0x43444948; else if (methodName.equals("equals") && args.length == 1 && method.getParameterTypes()[0] == Object.class) return equals(proxy, args[0]); else { /* Either someone is calling invoke by hand, or it is a non-final method from Object overriden by the generated Proxy. At the time of writing, the only non-final methods in Object that are not handled above are finalize and clone, and these are not overridden in generated proxies. */ // this plain Method.invoke is called only if the declaring class // is Object and so it's safe. return method.invoke(this, args); } } String propertyName = DefaultMXBeanMappingFactory.propertyName(method); if (propertyName == null) { throw new IllegalArgumentException("Method is not getter: " + method.getName()); } Object openValue; if (compositeData.containsKey(propertyName)) openValue = compositeData.get(propertyName); else { String decap = DefaultMXBeanMappingFactory.decapitalize(propertyName); if (compositeData.containsKey(decap)) openValue = compositeData.get(decap); else { final String msg = "No CompositeData item " + propertyName + (decap.equals(propertyName) ? "" : " or " + decap) + " to match " + methodName; throw new IllegalArgumentException(msg); } } MXBeanMapping mapping = MXBeanMappingFactory.DEFAULT.mappingForType(method.getGenericReturnType(), MXBeanMappingFactory.DEFAULT); return mapping.fromOpenValue(openValue); } /* This method is called when equals(Object) is * called on our proxy and hence forwarded to us. For example, if we * are a proxy for an interface like this: * public interface GetString { * public String string(); * } * then we must compare equal to another CompositeDataInvocationHandler * proxy for the same interface and where string() returns the same value. * * You might think that we should also compare equal to another * object that implements GetString directly rather than using * Proxy, provided that its string() returns the same result as * ours, and in fact an earlier version of this class did that (by * converting the other object into a CompositeData and comparing * that with ours). But in fact that doesn't make a great deal of * sense because there's absolutely no guarantee that the * resulting equals would be reflexive (otherObject.equals(this) * might be false even if this.equals(otherObject) is true), and, * especially, there's no way we could generate a hashCode() that * would be equal to otherObject.hashCode() when * this.equals(otherObject), because we don't know how * otherObject.hashCode() is computed. */ private boolean equals(Object proxy, Object other) { if (other == null) return false; final Class<?> proxyClass = proxy.getClass(); final Class<?> otherClass = other.getClass(); if (proxyClass != otherClass) return false; InvocationHandler otherih = Proxy.getInvocationHandler(other); if (!(otherih instanceof CompositeDataInvocationHandler)) return false; CompositeDataInvocationHandler othercdih = (CompositeDataInvocationHandler) otherih; return compositeData.equals(othercdih.compositeData); } private final CompositeData compositeData; private final MXBeanLookup lookup; }
⏎ javax/management/openmbean/CompositeDataInvocationHandler.java
Or download all of them as a single archive file:
File name: java.management-11.0.1-src.zip File size: 828174 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.management.rmi.jmod - Management RMI Module
2020-04-30, 86215👍, 0💬
Popular Posts:
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
What Is fop.jar? I got it from the fop-2.7-bin.zip. fop.jar in fop-2.7-bin.zip is the JAR file for F...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...