ClassSubstitution.java revision 12651:6ef01bd40ce2
166458Sdfr/*
266458Sdfr * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
366458Sdfr * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4139790Simp *
566458Sdfr * This code is free software; you can redistribute it and/or modify it
666458Sdfr * under the terms of the GNU General Public License version 2 only, as
766458Sdfr * published by the Free Software Foundation.
866458Sdfr *
966458Sdfr * This code is distributed in the hope that it will be useful, but WITHOUT
1066458Sdfr * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1166458Sdfr * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1266458Sdfr * version 2 for more details (a copy is included in the LICENSE file that
1366458Sdfr * accompanied this code).
1466458Sdfr *
1566458Sdfr * You should have received a copy of the GNU General Public License version
1666458Sdfr * 2 along with this work; if not, write to the Free Software Foundation,
1766458Sdfr * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1866458Sdfr *
1966458Sdfr * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2066458Sdfr * or visit www.oracle.com if you need additional information or have any
2166458Sdfr * questions.
2266458Sdfr */
2366458Sdfrpackage org.graalvm.compiler.api.replacements;
2466458Sdfr
2566458Sdfrimport java.lang.annotation.ElementType;
2666458Sdfrimport java.lang.annotation.Retention;
2766458Sdfrimport java.lang.annotation.RetentionPolicy;
2866458Sdfrimport java.lang.annotation.Target;
2966458Sdfr
3066458Sdfr/**
3166458Sdfr * Denotes a class that substitutes methods of another specified class. The substitute methods are
3266458Sdfr * exactly those annotated by {@link MethodSubstitution}.
3366458Sdfr */
3466458Sdfr@Retention(RetentionPolicy.RUNTIME)
3566458Sdfr@Target(ElementType.TYPE)
3666458Sdfrpublic @interface ClassSubstitution {
3766458Sdfr
3866458Sdfr    /**
3966458Sdfr     * Specifies the original class.
4066458Sdfr     * <p>
4166458Sdfr     * If the default value is specified for this element, then a non-default value must be given
42196994Sphk     * for the {@link #className()} element.
43196994Sphk     */
44196994Sphk    Class<?> value() default ClassSubstitution.class;
4566458Sdfr
4666458Sdfr    /**
4766458Sdfr     * Specifies the original class or classes if a single class is being used for multiple
4870508Sdfr     * substitutions.
49196994Sphk     * <p>
5096912Smarcel     * This method is provided for cases where the original class is not accessible (according to
51154128Simp     * Java language access control rules).
52154128Simp     * <p>
53154128Simp     * If the default value is specified for this element, then a non-default value must be given
5466458Sdfr     * for the {@link #value()} element.
5566458Sdfr     */
5666458Sdfr    String[] className() default {};
5766458Sdfr
5866458Sdfr    /**
5966458Sdfr     * Determines if the substitutions are for classes that may not be part of the runtime.
60210369Skib     * Substitutions for such classes are omitted if the original classes cannot be found.
61210369Skib     */
62210369Skib    boolean optional() default false;
6366458Sdfr}
64177661Sjb