APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.jmx.mbeanserver

public Class DefaultMXBeanMappingFactory

extends MXBeanMappingFactory
Class Inheritance
Static Imports
com.sun.jmx.mbeanserver.Util.*, .MXBeanIntrospector.typeName, javax.management.openmbean.SimpleType.*

A converter between Java types and the limited set of classes defined by Open MBeans.

A Java type is an instance of java.lang.reflect.Type. For our purposes, it is either a Class, such as String.class or int.class; or a ParameterizedType, such as List<String> or Map<Integer, String[]>. On J2SE 1.4 and earlier, it can only be a Class.

Each Type is associated with an DefaultMXBeanMappingFactory. The DefaultMXBeanMappingFactory defines an OpenType corresponding to the Type, plus a Java class corresponding to the OpenType. For example:

Type                     Open class     OpenType
 ----                     ----------     --------
 Integer                  Integer        SimpleType.INTEGER
 int                      int            SimpleType.INTEGER
 Integer[]                Integer[]      ArrayType(1, SimpleType.INTEGER)
 int[]                    Integer[]      ArrayType(SimpleType.INTEGER, true)
 String[][]               String[][]     ArrayType(2, SimpleType.STRING)
 List<String>             String[]       ArrayType(1, SimpleType.STRING)
 ThreadState (an Enum)    String         SimpleType.STRING
 Map<Integer, String[]>   TabularData    TabularType(
                                         CompositeType(
                                           {"key", SimpleType.INTEGER},
                                           {"value",
                                             ArrayType(1,
                                              SimpleType.STRING)}),
                                         indexNames={"key"})
 

Apart from simple types, arrays, and collections, Java types are converted through introspection into CompositeType. The Java type must have at least one getter (method such as "int getSize()" or "boolean isBig()"), and we must be able to deduce how to reconstruct an instance of the Java class from the values of the getters using one of various heuristics.

Since
1.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private abstract static class
DefaultMXBeanMappingFactory.CompositeBuilder

Converts from a CompositeData to an instance of the targetClass.

private static class
DefaultMXBeanMappingFactory.CompositeBuilderCheckGetters

This builder never actually returns success.

private static class
DefaultMXBeanMappingFactory.CompositeBuilderViaConstructor

Builder for when the target class has a constructor that is annotated with @ConstructorParameters or @ConstructorProperties so we can see the correspondence to getters.

private static class
DefaultMXBeanMappingFactory.CompositeBuilderViaFrom

Builder for when the target class has a method "public static from(CompositeData)".

private static class
DefaultMXBeanMappingFactory.CompositeBuilderViaProxy

Builder for when the target class is an interface and contains no methods other than getters.

private static class
DefaultMXBeanMappingFactory.CompositeBuilderViaSetters

Builder for when the target class has a setter for every getter.

private static class
private static class
private static class
private static class
private static class
pack-priv abstract static class
private static class
DefaultMXBeanMappingFactory.RecordCompositeBuilder

Builder for when the target class is a record

private static class

Field Summary

Modifier and TypeField and Description
private static final Map<Type, Type>
private static final String[]
private static final String[]
private static final DefaultMXBeanMappingFactory.Mappings
private static final List<MXBeanMapping>
permanentMappings

Following List simply serves to keep a reference to predefined MXBeanMappings so they don't get garbage collected.

Inherited from com.sun.jmx.mbeanserver.MXBeanMappingFactory:
DEFAULT

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
capitalize(String name)

Reverse operation for java.beans.Introspector.decapitalize.

public static String

Returns:

The decapitalized version of the string.
decapitalize
(String
The string to be decapitalized.
name
)

Utility method to take a string and convert it to normal Java variable name capitalization.

private static synchronized MXBeanMapping
pack-priv static InvalidObjectException
pack-priv static InvalidObjectException
pack-priv static boolean
private MXBeanMapping
makeArrayOrCollectionMapping(Type collectionType, Type elementType, MXBeanMappingFactory factory)

private MXBeanMapping
private static <T extends Enum<T>> MXBeanMapping
makeEnumMapping(Class<?> enumClass, Class<T> fake)

private MXBeanMapping
private static MXBeanMapping
private MXBeanMapping
private MXBeanMapping
makeTabularMapping(Type objType, boolean sortedMap, Type keyType, Type valueType, MXBeanMappingFactory factory)

public synchronized MXBeanMapping
mappingForType(Type objType, MXBeanMappingFactory factory)

Implements abstract com.sun.jmx.mbeanserver.MXBeanMappingFactory.mappingForType.

Get the converter for the given Java type, creating it if necessary.

pack-priv static void
mustBeComparable(Class<?> collection, Type element)

pack-priv static OpenDataException
pack-priv static OpenDataException
public static String
private static synchronized void
putMapping(Type type, MXBeanMapping mapping)

private static synchronized void