001 /*****************************************************************************
002 * Copyright (C) NanoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file. *
007 * *
008 * Original code by Joerg Schaible *
009 *****************************************************************************/
010
011 package org.picocontainer.gems.jmx;
012
013 /**
014 * An abstract ObjectNameFactory that offers functionality to handle the domain part of the object name.
015 * @author Jörg Schaible
016 */
017 public abstract class AbstractObjectNameFactory implements ObjectNameFactory {
018
019 private final String domain;
020
021 /**
022 * Construct an AbstractObjectNameFactory.
023 * @param domain The name of the domain, use <code>null</code> for the default domain.
024 */
025 protected AbstractObjectNameFactory(final String domain) {
026 this.domain = domain;
027 }
028
029 /**
030 * @return Return the domain part of the {@link javax.management.ObjectName}.
031 */
032 protected String getDomain() {
033 return domain != null ? domain : "";
034 }
035 }