    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005// http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5.annotations;
    014
    015import static java.lang.annotation.ElementType.PARAMETER;
    016import static java.lang.annotation.RetentionPolicy.RUNTIME;
    017import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.PAGE;
    018import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.COMPONENT;
    019import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.MIXIN;
    020
    021import java.lang.annotation.Documented;
    022import java.lang.annotation.Retention;
    023import java.lang.annotation.Target;
    024
    025import org.apache.tapestry5.ioc.annotations.UseWith;
    026
    027/**
    028 * Annotation that may be placed on parameters of event handler methods to define them
    029 * as having a static value. If, in a given request, the activation context value for that
    030 * parameter doesn't match the static value, the event handler method won't be called.
    031 * This is particularly useful for REST endpoint event handler methods in pages.
    032 *
    033 * @since 5.8.0
    034 */
    035@Target(
    036{ PARAMETER })
    037@Retention(RUNTIME)
    038@Documented
    039@UseWith(
    040{ PAGE, COMPONENT, MIXIN })
    041public @interface StaticActivationContextValue
    042{
    043    /**
    044     * The activation context value, case sensitive. Empty values or ones with spaces are forbidden.
    045     */
    046    String value();
    047}