src/main/java/com/amlinv/jmxutil/polling/ObjectQueryPreparer.java
public ObjectQueryInfo prepareObjectQuery(Object obj) throws MalformedObjectNameException {

        ObjectQueryInfo result;

        //
        // Extract the mbean info from the object (TBD: cache this information ahead of time)
        //
        String onamePattern = MBeanAnnotationUtil.getLocationONamePattern(obj);

        if (onamePattern != null) {
            //
            // Locate the setters and continue only if at least one was found.
            //
            Map<String, Method> attributeSetters = MBeanAnnotationUtil.getAttributes(obj);

            if (attributeSetters.size() > 0) {
                String onameString;

                if (obj instanceof MBeanLocationParameterSource) {
                    onameString = this.parameterReplacer
                            .replaceObjectNameParameters(onamePattern, (MBeanLocationParameterSource) obj);
                } else {
                    onameString = onamePattern;
                }

                ObjectName oname = new ObjectName(onameString);

                result = new ObjectQueryInfo(obj, oname, attributeSetters);
            } else {
                this.logNoAttributeThrottle.warn(log,
                        "ignoring attempt to prepare to poll an MBean object with no attributes: onamePattern={}",
                        onamePattern);
                result = null;
            }
        } else {
            log.warn("ignoring attempt to prepare to poll object that has no MBeanLocation");
            result = null;
        }

        return result;
    }
public ObjectQueryInfo prepareObjectQuery(Object obj) throws MalformedObjectNameException {

        ObjectQueryInfo result;

        //
        // Extract the mbean info from the object (TBD: cache this information ahead of time)
        //
        String onamePattern = MBeanAnnotationUtil.getLocationONamePattern(obj);

        if (onamePattern != null) {
            //
            // Locate the setters and continue only if at least one was found.
            //
            Map<String, Method> attributeSetters = MBeanAnnotationUtil.getAttributes(obj);

            if (attributeSetters.size() > 0) {
                String onameString;

                if (obj instanceof MBeanLocationParameterSource) {
                    onameString = this.parameterReplacer
                            .replaceObjectNameParameters(onamePattern, (MBeanLocationParameterSource) obj);
                } else {
                    onameString = onamePattern;
                }

                ObjectName oname = new ObjectName(onameString);

                result = new ObjectQueryInfo(obj, oname, attributeSetters);
            } else {
                this.logNoAttributeThrottle.warn(log,
                        "ignoring attempt to prepare to poll an MBean object with no attributes: onamePattern={}",
                        onamePattern);
                result = null;
            }
        } else {
            log.warn("ignoring attempt to prepare to poll object that has no MBeanLocation");
            result = null;
        }

        return result;
    }
Prepare to query the given object.

@param obj the object to prepare; must be annotated appropriately with @MBeanLocation on the class and
@MBeanAttribute on setter methods.
@return the results of the prepared object.
@throws MalformedObjectNameException
@see com.amlinv.jmxutil.annotation.MBeanLocation
@see com.amlinv.jmxutil.annotation.MBeanAttribute