Modifier.java revision 2571:10fc81ac75b4
144574Sphk/*
244574Sphk * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
375540Sjhay * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
444574Sphk *
544574Sphk * This code is free software; you can redistribute it and/or modify it
644574Sphk * under the terms of the GNU General Public License version 2 only, as
744574Sphk * published by the Free Software Foundation.  Oracle designates this
844574Sphk * particular file as subject to the "Classpath" exception as provided
944574Sphk * by Oracle in the LICENSE file that accompanied this code.
1044574Sphk *
1144574Sphk * This code is distributed in the hope that it will be useful, but WITHOUT
1244574Sphk * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1344574Sphk * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1444574Sphk * version 2 for more details (a copy is included in the LICENSE file that
1544574Sphk * accompanied this code).
1644574Sphk *
1744574Sphk * You should have received a copy of the GNU General Public License version
182291Sjkh * 2 along with this work; if not, write to the Free Software Foundation,
192291Sjkh * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
202291Sjkh *
212291Sjkh * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2275540Sjhay * or visit www.oracle.com if you need additional information or have any
2365432Sphk * questions.
2465432Sphk */
2565432Sphk
2644574Sphkpackage javax.lang.model.element;
2744574Sphk
2844574Sphk
2921101Sjhay/**
3021101Sjhay * Represents a modifier on a program element such
3121101Sjhay * as a class, method, or field.
322291Sjkh *
332291Sjkh * <p>Not all modifiers are applicable to all kinds of elements.
342291Sjkh * When two or more modifiers appear in the source code of an element
352291Sjkh * then it is customary, though not required, that they appear in the same
362291Sjkh * order as the constants listed in the detail section below.
372291Sjkh *
382291Sjkh * <p>Note that it is possible additional modifiers will be added in
392291Sjkh * future versions of the platform.
402291Sjkh *
412291Sjkh * @author Joseph D. Darcy
422291Sjkh * @author Scott Seligman
432291Sjkh * @author Peter von der Ah&eacute;
442291Sjkh * @since 1.6
452291Sjkh */
4655205Speter
4755205Speterpublic enum Modifier {
482291Sjkh
492291Sjkh    // See JLS sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1.
502291Sjkh    // java.lang.reflect.Modifier includes INTERFACE, but that's a VMism.
512291Sjkh
5244574Sphk    /** The modifier {@code public} */          PUBLIC,
532291Sjkh    /** The modifier {@code protected} */       PROTECTED,
542291Sjkh    /** The modifier {@code private} */         PRIVATE,
5544574Sphk    /** The modifier {@code abstract} */        ABSTRACT,
5644574Sphk    /**
5744574Sphk     * The modifier {@code default}
5844574Sphk     * @since 1.8
5944574Sphk     */
6044574Sphk     DEFAULT,
6144574Sphk    /** The modifier {@code static} */          STATIC,
6244574Sphk    /** The modifier {@code final} */           FINAL,
632291Sjkh    /** The modifier {@code transient} */       TRANSIENT,
642291Sjkh    /** The modifier {@code volatile} */        VOLATILE,
652291Sjkh    /** The modifier {@code synchronized} */    SYNCHRONIZED,
662291Sjkh    /** The modifier {@code native} */          NATIVE,
672291Sjkh    /** The modifier {@code strictfp} */        STRICTFP;
682291Sjkh
6944666Sphk    /**
702291Sjkh     * Returns this modifier's name in lowercase.
7144574Sphk     */
7244666Sphk    public String toString() {
7344574Sphk        return name().toLowerCase(java.util.Locale.US);
7444574Sphk    }
7544574Sphk}
7644574Sphk