public ResourceDMBean(Object instance) {
        if(instance == null)
            throw new NullPointerException("Cannot make an MBean wrapper for null instance");
        this.obj=instance;
        Class<? extends Object> c=obj.getClass();
        expose_all=c.isAnnotationPresent(MBean.class) && c.getAnnotation(MBean.class).exposeAll();

        findFields(instance);
        findMethods(instance);
        fixFields(instance);

        if(instance instanceof AdditionalJmxObjects) {
            Object[] objects=((AdditionalJmxObjects)instance).getJmxObjects();
            if(objects != null) {
                for(Object inst: objects) {
                    if(inst != null) {
                        if(objs == null)
                            objs=new ArrayList<>();
                        objs.add(inst);
                        findFields(inst);
                        findMethods(inst);
                        fixFields(inst);
                    }
                }
            }
        }

        attrInfo=new MBeanAttributeInfo[atts.size()];
        int i=0;
        MBeanAttributeInfo info=null;
        for(AttributeEntry entry: atts.values()) {
            info=entry.info;
            attrInfo[i++]=info;
        }

        opInfo=new MBeanOperationInfo[ops.size()];
        ops.toArray(opInfo);
    }