com.sun.jmx.mbeanserver.MXBeanMapping Java Examples
The following examples show how to use
com.sun.jmx.mbeanserver.MXBeanMapping.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenMethod.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public Object[] convertParamsToOpenTypes(Object[] params) throws OpenDataException { final MXBeanMapping[] paramConverters = this.paramConverters; if (paramConverters != null && params != null && params.length > 0) { final Object[] openTypeParams = new Object[params.length]; for (int i = 0; i < params.length; i++) { openTypeParams[i] = paramConverters[i].toOpenValue(params[i]); } return openTypeParams; } else { return params; } }
Example #2
Source File: OpenMethod.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public OpenMethod(Method m) { try { final MXBeanMappingFactory mapping = MXBeanMappingFactory.DEFAULT; final Type[] params = m.getGenericParameterTypes(); final MXBeanMapping[] paramConverters = new MXBeanMapping[params.length]; boolean skipParamsConversion = true; // using reflection since isIdentity method is package protected final Method identityCheck = DefaultMXBeanMappingFactory.class .getDeclaredMethod("isIdentity", MXBeanMapping.class); identityCheck.setAccessible(true); for (int i = 0; i < params.length; i++) { paramConverters[i] = mapping.mappingForType(params[i], mapping); if (skipParamsConversion) { skipParamsConversion = (Boolean)identityCheck.invoke(null, paramConverters[i]); } } // null converters denotes no conversion required for the case when // all parameter conversions are identity converters this.paramConverters = skipParamsConversion ? null : paramConverters; this.returnValConverter = mapping.mappingForType( m.getGenericReturnType(), mapping); } catch (OpenDataException ode) { throw new IllegalArgumentException("Failed getting converter of " + "parameter or return value to open type for given method: " + m, ode); } catch (Exception e) { throw new IllegalStateException("Exception getting converter of " + "parameter or return value to open type of given method: " + m, e); } }
Example #3
Source File: OpenMethod.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public Object[] convertParamsToOpenTypes(Object[] params) throws OpenDataException { final MXBeanMapping[] paramConverters = this.paramConverters; if (paramConverters != null && params != null && params.length > 0) { final Object[] openTypeParams = new Object[params.length]; for (int i = 0; i < params.length; i++) { openTypeParams[i] = paramConverters[i].toOpenValue(params[i]); } return openTypeParams; } else { return params; } }
Example #4
Source File: OpenMethod.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public OpenMethod(Method m) { try { final MXBeanMappingFactory mapping = MXBeanMappingFactory.DEFAULT; final Type[] params = m.getGenericParameterTypes(); final MXBeanMapping[] paramConverters = new MXBeanMapping[params.length]; boolean skipParamsConversion = true; // using reflection since isIdentity method is package protected final Method identityCheck = DefaultMXBeanMappingFactory.class .getDeclaredMethod("isIdentity", MXBeanMapping.class); identityCheck.setAccessible(true); for (int i = 0; i < params.length; i++) { paramConverters[i] = mapping.mappingForType(params[i], mapping); if (skipParamsConversion) { skipParamsConversion = (Boolean)identityCheck.invoke(null, paramConverters[i]); } } // null converters denotes no conversion required for the case when // all parameter conversions are identity converters this.paramConverters = skipParamsConversion ? null : paramConverters; this.returnValConverter = mapping.mappingForType( m.getGenericReturnType(), mapping); } catch (OpenDataException ode) { throw new IllegalArgumentException("Failed getting converter of " + "parameter or return value to open type for given method: " + m, ode); } catch (Exception e) { throw new IllegalStateException("Exception getting converter of " + "parameter or return value to open type of given method: " + m, e); } }
Example #5
Source File: CompositeDataInvocationHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #6
Source File: CompositeDataInvocationHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #7
Source File: CompositeDataInvocationHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #8
Source File: CompositeDataInvocationHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #9
Source File: CompositeDataInvocationHandler.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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); }
Example #10
Source File: CompositeDataInvocationHandler.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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); }
Example #11
Source File: CompositeDataInvocationHandler.java From hottub with GNU General Public License v2.0 | 4 votes |
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); }
Example #12
Source File: CompositeDataInvocationHandler.java From Java8CN with Apache License 2.0 | 4 votes |
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); }
Example #13
Source File: CompositeDataInvocationHandler.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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); }
Example #14
Source File: CompositeDataInvocationHandler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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); }
Example #15
Source File: CompositeDataInvocationHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
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); }
Example #16
Source File: CompositeDataInvocationHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
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); }
Example #17
Source File: CompositeDataInvocationHandler.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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); }
Example #18
Source File: CompositeDataInvocationHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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); }
Example #19
Source File: CompositeDataInvocationHandler.java From JDKSourceCode1.8 with MIT License | 4 votes |
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); }
Example #20
Source File: CompositeDataInvocationHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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); }
Example #21
Source File: MXBeanMappingFactory.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #22
Source File: MXBeanMappingFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #23
Source File: MXBeanMappingFactory.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #24
Source File: MXBeanMappingFactory.java From JDKSourceCode1.8 with MIT License | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #25
Source File: MXBeanMappingFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #26
Source File: MXBeanMappingFactory.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #27
Source File: MXBeanMappingFactory.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #28
Source File: MXBeanMappingFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #29
Source File: MXBeanMappingFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;
Example #30
Source File: MXBeanMappingFactory.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * <p>Return the mapping for the given Java type. Typically, a * mapping factory will return mappings for types it handles, and * forward other types to another mapping factory, most often * the {@linkplain #DEFAULT default one}.</p> * @param t the Java type to be mapped. * @param f the original mapping factory that was consulted to do * the mapping. A mapping factory should pass this parameter intact * if it forwards a type to another mapping factory. In the example, * this is how {@code MyLinkedListMappingFactory} works for types * like {@code MyLinkedList[]} and {@code List<MyLinkedList>}. * @return the mapping for the given type. * @throws OpenDataException if this type cannot be mapped. This * exception is appropriate if the factory is supposed to handle * all types of this sort (for example, all linked lists), but * cannot handle this particular type. */ public abstract MXBeanMapping mappingForType(Type t, MXBeanMappingFactory f) throws OpenDataException;