All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tudalgo.algoutils.student.annotation.Forbidden Maven / Gradle / Ivy

The newest version!
package org.tudalgo.algoutils.student.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation is used to mark methods from the standard library,
 * that are forbidden to be used by the student in order to implement the annotated method.
 *
 * 

The following example shows how to use this annotation:

* *
{@code
 *             @Forbidden("java.lang.Math.max")
 *             public static int max(int a, int b) {
 *                 if (a > b) {
 *                     return a;
 *                 } else {
 *                     return b;
 *                 }
 *             }
 *         }
*

Alternatively the entire class or package can be forbidden:

* *
{@code
 *             @Forbidden("java.lang.Math")
 *             public static int max(int a, int b) {
 *                 if (a > b) {
 *                      return a;
 *                 } else {
 *                     return b;
 *                 }
 *             }
 *        }
*/ @Documented @Inherited @Retention(RetentionPolicy.CLASS) @Target({ElementType.METHOD}) public @interface Forbidden { /** * The forbidden methods. * * @return the forbidden methods */ String[] value() default { }; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy