/*
 * Copyright 2020 Netflix, Inc.
 *
 *      Licensed under the Apache License, Version 2.0 (the "License");
 *      you may not use this file except in compliance with the License.
 *      You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *      Unless required by applicable law or agreed to in writing, software
 *      distributed under the License is distributed on an "AS IS" BASIS,
 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *      See the License for the specific language governing permissions and
 *      limitations under the License.
 */

package com.netflix.zuul;

import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.netflix.zuul.filters.FilterSyncType;
import com.netflix.zuul.filters.FilterType;
import com.netflix.zuul.filters.ZuulFilter;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Identifies a {@link ZuulFilter}.
 */
@Target({TYPE})
@Retention(RUNTIME)
@Documented
public @interface Filter {

    /**
     * The order in which to run.   See {@link ZuulFilter#filterOrder()}.
     */
    int order();

    /**
     * Indicates the type of this filter.
     */
    FilterType type() default FilterType.INBOUND;

    /**
     * Indicates if this is a synchronous filter.
     */
    FilterSyncType sync() default FilterSyncType.SYNC;

    @Target({PACKAGE})
    @Retention(CLASS)
    @Documented
    @interface FilterPackageName {
        String value();
    }

    /**
     * Indicates that the annotated filter should run after another filter in the chain, if the other filter is present.
     * In the case of inbound filters, this implies that the annotated filter should have an order greater than the
     * filters listed.  For outbound filters, the order of this filter should be less than the ones listed.  Usage of
     * this annotation should be used on homogeneous filter types.  Additionally, this should not be applied to endpoint
     * filters.
     */
    @Target({TYPE})
    @Retention(RUNTIME)
    @Documented
    @interface ApplyAfter {
        Class<? extends ZuulFilter<?, ?>>[] value();
    }
}

@@ -2383,11 +2383,899 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Indicates that the annotated filter should run before another filter in the chain, if the other filter is present.%0A     * In the case of inbound filters, this implies that the annotated filter should have an order less than the%0A     * filters listed.  For outbound filters, the order of this filter should be greater than the ones listed.  Usage of%0A     * this annotation should be used on homogeneous filter types.  Additionally, this should not be applied to endpoint%0A     * filters.%0A     *%0A     * %3Cp%3EPrefer to use this %7B@link ApplyAfter%7D instead.  This annotation is meant in case where it may be infeasible%0A     * to use %7B@linkplain ApplyAfter%7D.  (such as due to dependency cycles)%0A     *%0A     * @see ApplyAfter%0A     */%0A    @Target(%7BTYPE%7D)%0A    @Retention(RUNTIME)%0A    @Documented%0A    @interface ApplyBefore %7B%0A        Class%3C? extends ZuulFilter%3C?, ?%3E%3E%5B%5D value();%0A    %7D
 %0A%7D%0A

allow expressing ApplyBefore rules