001/*
002 * Copyright 2011 Atteo.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License
010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011 * or implied. See the License for the specific language governing permissions and limitations under
012 * the License.
013 */
014package org.atteo.moonshine.jmx;
015
016import java.lang.annotation.Documented;
017import java.lang.annotation.ElementType;
018import java.lang.annotation.Retention;
019import java.lang.annotation.RetentionPolicy;
020import java.lang.annotation.Target;
021
022import javax.inject.Singleton;
023
024import org.atteo.evo.classindex.IndexAnnotated;
025
026/**
027 * MBean marker interface.
028 *
029 * <p>
030 * Any annotated classes will be discovered and registered by {@link JMX} service as MBean.
031 * By convention any such class should implement an interface with the same name
032 * with the suffix <i>MBean</i> added (see <a href="http://download.oracle.com/javase/tutorial/jmx/mbeans/standard.html">JMX tutorial</a>).
033 * </p>
034 * <p>
035 * Additionally annotated class will be registered in Guice with {@link Singleton} scope.
036 */
037@Target(ElementType.TYPE)
038@Retention(RetentionPolicy.RUNTIME)
039@Documented
040@IndexAnnotated
041public @interface MBean {
042    /**
043     * Name that the MBean will be registered with.
044     * <p>
045     * If not specified, one will be generated based on full class name of the annotated class.
046     * </p>
047     */
048    String name() default "";
049}