jdk/src/share/classes/com/sun/jmx/mbeanserver/StandardMBeanSupport.java
changeset 4156 acaa49a2768a
parent 834 dc74d4ddc28e
child 5506 202f599c92aa
equal deleted inserted replaced
4155:460e37d40f12 4156:acaa49a2768a
    29 
    29 
    30 import javax.management.MBeanInfo;
    30 import javax.management.MBeanInfo;
    31 import javax.management.MBeanServer;
    31 import javax.management.MBeanServer;
    32 import javax.management.NotCompliantMBeanException;
    32 import javax.management.NotCompliantMBeanException;
    33 import javax.management.ObjectName;
    33 import javax.management.ObjectName;
    34 import javax.management.openmbean.MXBeanMappingFactory;
       
    35 
    34 
    36 /**
    35 /**
    37  * Base class for Standard MBeans.
    36  * Base class for Standard MBeans.
    38  *
    37  *
    39  * @since 1.6
    38  * @since 1.6
    56      *       if it does not implement the class {@code mbeanInterfaceType} or if
    55      *       if it does not implement the class {@code mbeanInterfaceType} or if
    57      *       that class is not a valid Standard MBean interface.
    56      *       that class is not a valid Standard MBean interface.
    58      */
    57      */
    59     public <T> StandardMBeanSupport(T resource, Class<T> mbeanInterfaceType)
    58     public <T> StandardMBeanSupport(T resource, Class<T> mbeanInterfaceType)
    60             throws NotCompliantMBeanException {
    59             throws NotCompliantMBeanException {
    61         super(resource, mbeanInterfaceType, (MXBeanMappingFactory) null);
    60         super(resource, mbeanInterfaceType);
    62     }
    61     }
    63 
    62 
    64     @Override
    63     @Override
    65     MBeanIntrospector<Method> getMBeanIntrospector(MXBeanMappingFactory ignored) {
    64     MBeanIntrospector<Method> getMBeanIntrospector() {
    66         return StandardMBeanIntrospector.getInstance();
    65         return StandardMBeanIntrospector.getInstance();
    67     }
    66     }
    68 
    67 
    69     @Override
    68     @Override
    70     Object getCookie() {
    69     Object getCookie() {
    82      * to reconstruct this MBeanInfo if necessary.
    81      * to reconstruct this MBeanInfo if necessary.
    83      */
    82      */
    84     @Override
    83     @Override
    85     public MBeanInfo getMBeanInfo() {
    84     public MBeanInfo getMBeanInfo() {
    86         MBeanInfo mbi = super.getMBeanInfo();
    85         MBeanInfo mbi = super.getMBeanInfo();
    87         Class<?> resourceClass = getWrappedObject().getClass();
    86         Class<?> resourceClass = getResource().getClass();
    88         if (!getMBeanInterface().isInterface() ||
    87         if (StandardMBeanIntrospector.isDefinitelyImmutableInfo(resourceClass))
    89                 StandardMBeanIntrospector.isDefinitelyImmutableInfo(resourceClass))
       
    90             return mbi;
    88             return mbi;
    91         return new MBeanInfo(mbi.getClassName(), mbi.getDescription(),
    89         return new MBeanInfo(mbi.getClassName(), mbi.getDescription(),
    92                 mbi.getAttributes(), mbi.getConstructors(),
    90                 mbi.getAttributes(), mbi.getConstructors(),
    93                 mbi.getOperations(),
    91                 mbi.getOperations(),
    94                 MBeanIntrospector.findNotifications(getWrappedObject()),
    92                 MBeanIntrospector.findNotifications(getResource()),
    95                 mbi.getDescriptor());
    93                 mbi.getDescriptor());
    96     }
    94     }
    97 }
    95 }