com.ocpsoft.pretty.faces.annotation.URLAction Maven / Gradle / Ivy
/*
* Copyright 2010 Lincoln Baxter, III
*
* 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.ocpsoft.pretty.faces.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;
/**
*
* Specifies an action method to be called after URL parameters have been parsed
* and assigned into beans.
*
*
* If the class containing the action method is annotated with a
* {@link URLMapping} annotation, the action will automatically be added to this
* mapping. You can also add the action to a foreign mapping by referencing it
* with the mappingId
attribute.
*
*
* You can use {@link URLActions} as a container if you want to add multiple
* {@link URLAction} annotations to a single method.
*
*
* @author Christian Kaltepoth
* @see URLMapping
* @see URLActions
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Inherited
@Documented
public @interface URLAction
{
/**
*
* For use with {@link URLAction#phaseId()}
*
*/
public enum PhaseId
{
ANY_PHASE,
RESTORE_VIEW,
APPLY_REQUEST_VALUES,
PROCESS_VALIDATIONS,
UPDATE_MODEL_VALUES,
INVOKE_APPLICATION,
RENDER_RESPONSE;
}
/**
*
* Optional ID of the mapping to add this action to. If no ID is given, the
* action will be added to the mapping specified on the class the annotated
* method belongs to.
*
*/
String mappingId() default "";
/**
*
* Optional boolean (default true), if set to false, this action method will
* not occur on form postback.
*
*
*/
boolean onPostback() default true;
/**
*
* {@link PhaseId} value (default after RESTORE_VIEW) if set to a valid JSF
* PhaseId, the action will occur immediately before the specified Phase (or
* immediately after RESTORE_VIEW).
*
*
* Note however, that if the phase does not occur, neither will your action
* method.
*
*
* If ANY_PHASE is specified, the action method will fire on EVERY phase.
*
*/
PhaseId phaseId() default PhaseId.RESTORE_VIEW;
/**
* Whether child mappings inherit this action or not.
*/
boolean inheritable() default false;
}