Package org.jolokia.client.jmxadapter
Class ToOpenTypeConverter
java.lang.Object
org.jolokia.client.jmxadapter.ToOpenTypeConverter
Attempt to produce openmbean results to emulate a native JMX connection by reverse engineering
type information from JSON response from Jolokia and use the appropriate converter to convert to
corresponding objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidSpecify type to use for an attribute, operation or an attribute within the response.static OpenType<?>introspectComplexTypeFrom(Class<?> klass) static OpenType<?>recursivelyBuildOpenType(String name, Object rawValue, String typeFromMBeanInfo) Try to figure out open type, order of preference 1.static ObjectreturnOpenTypedValue(String name, Object rawValue, String typeFromMBeanInfo)
-
Constructor Details
-
ToOpenTypeConverter
public ToOpenTypeConverter()
-
-
Method Details
-
returnOpenTypedValue
public static Object returnOpenTypedValue(String name, Object rawValue, String typeFromMBeanInfo) throws OpenDataException - Throws:
OpenDataException
-
recursivelyBuildOpenType
public static OpenType<?> recursivelyBuildOpenType(String name, Object rawValue, String typeFromMBeanInfo) throws OpenDataException Try to figure out open type, order of preference 1. handle simple objects, respect type introspected from MBeanInfo if any 2. Handle arrays (comes before cached types due to issues specifying multiple return values for all the Threading overloaded methods) 3. Handle hard coded tabular return types (important for visual presentation in certain tools) 4. Use cached type for attribute/item : either hardcoded to please JConsole / JVisualVM or introspected from MBeanInfo 5. Dynamically build structured type from contents (will struggle with null values for unknown entities) 6. Fail- Throws:
OpenDataException
-
cacheType
Specify type to use for an attribute, operation or an attribute within the response. SyntaxcacheType(TYPE, "ObjectName.Operation/Attribute.item(if array).attribute.innerattribute")
- Parameters:
type- type to apply for reverse engineeringnames- One or more items to type according to syntax given above
-
introspectComplexTypeFrom
- Parameters:
klass- The Java type- Returns:
- OpenType deducted from Java type by reflection
- Throws:
OpenDataException- When the open type is not found
-