jdk/src/share/classes/javax/management/ManagedAttribute.java
author sjiang
Thu, 31 Jul 2008 15:31:13 +0200
changeset 1004 5ba8217eb504
parent 833 bfa2bef7517c
child 1247 b4c26443dee5
permissions -rw-r--r--
5108776: Add reliable event handling to the JMX API 6218920: API bug - impossible to delete last MBeanServerForwarder on a connector Reviewed-by: emcmanus
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
833
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     1
/*
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     2
 * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     4
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    10
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    15
 * accompanied this code).
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    16
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    20
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    23
 * have any questions.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    24
 */
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    25
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    26
package javax.management;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    27
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    28
import java.lang.annotation.Documented;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    29
import java.lang.annotation.ElementType;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    30
import java.lang.annotation.Retention;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    31
import java.lang.annotation.RetentionPolicy;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    32
import java.lang.annotation.Target;
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    33
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    34
/**
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    35
 * <p>Indicates that a method in an MBean class defines an MBean attribute.
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    36
 * This annotation must be applied to a public method of a public class
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    37
 * that is itself annotated with an {@link MBean @MBean} or
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    38
 * {@link MXBean @MXBean} annotation, or inherits such an annotation from
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    39
 * a superclass.</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    40
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    41
 * <p>The annotated method must be a getter or setter.  In other words,
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    42
 * it must look like one of the following...</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    43
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    44
 * <pre>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    45
 * <i>T</i> get<i>Foo</i>()
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    46
 * void set<i>Foo</i>(<i>T</i> param)
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    47
 * </pre>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    48
 *
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    49
 * <p>...where <i>{@code T}</i> is any type and <i>{@code Foo}</i> is the
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    50
 * name of the attribute.  For any attribute <i>{@code Foo}</i>, if only
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    51
 * a {@code get}<i>{@code Foo}</i> method has a {@code ManagedAttribute}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    52
 * annotation, then <i>{@code Foo}</i> is a read-only attribute.  If only
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    53
 * a {@code set}<i>{@code Foo}</i> method has a {@code ManagedAttribute}
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    54
 * annotation, then <i>{@code Foo}</i> is a write-only attribute.  If
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    55
 * both {@code get}<i>{@code Foo}</i> and {@code set}<i>{@code Foo}</i>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    56
 * methods have the annotation, then <i>{@code Foo}</i> is a read-write
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    57
 * attribute.  In this last case, the type <i>{@code T}</i> must be the
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    58
 * same in both methods.</p>
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    59
 */
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    60
@Retention(RetentionPolicy.RUNTIME)
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    61
@Target(ElementType.METHOD)
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    62
@Documented
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    63
public @interface ManagedAttribute {
bfa2bef7517c 6323980: Annotations to simplify MBean development
emcmanus
parents:
diff changeset
    64
}