01: /*****************************************************************************
02: * Copyright (C) NanoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by Joerg Schaible *
09: *****************************************************************************/package org.picocontainer.gems.jmx;
10:
11: import javax.management.DynamicMBean;
12: import javax.management.ObjectName;
13:
14: /**
15: * An ObjectNameFactory, that uses the key of the Pico component as {@link ObjectName}, if the key is of this type.
16: * @author Jörg Schaible
17: */
18: public class PredefinedObjectNameFactory implements ObjectNameFactory {
19:
20: /**
21: * Return the <code>key</code> if it is an {@link ObjectName}.
22: * @see org.picocontainer.gems.jmx.ObjectNameFactory#create(java.lang.Object, javax.management.DynamicMBean)
23: */
24: public ObjectName create(final Object key, final DynamicMBean mBean) {
25: return key instanceof ObjectName ? (ObjectName) key : null;
26: }
27:
28: }
|