code: public static ObjectName makeObjectName(JmxResource jmxResource, JmxSelfNaming selfNamingObj) {
  		String domainName = selfNamingObj.getJmxDomainName();
  		if (domainName == null) {
  			if (jmxResource != null) {
  				domainName = jmxResource.domainName();
  			}
  			if (isEmpty(domainName)) {
  				throw new IllegalArgumentException(
  						"Could not create ObjectName because domain name not specified in getJmxDomainName() nor @JmxResource");
  			}
  		}
  		String beanName = selfNamingObj.getJmxBeanName();
  		if (beanName == null) {
  			if (jmxResource != null) {
  				beanName = getBeanName(jmxResource);
  			}
  			if (isEmpty(beanName)) {
  				beanName = selfNamingObj.getClass().getSimpleName();
  			}
  		}
  		String[] jmxResourceFolders = null;
  		if (jmxResource != null) {
  			jmxResourceFolders = jmxResource.folderNames();
  		}
  		return makeObjectName(domainName, beanName, selfNamingObj.getJmxFolderNames(), jmxResourceFolders);
  	}
docs: Constructs an object-name from a jmx-resource and a self naming object.
  
  @param jmxResource
  Annotation from the class for which we are creating our ObjectName. It may be null.
  @param selfNamingObj
  Object that implements the self-naming interface.
  @throws IllegalArgumentException
  If we had problems building the name