    001// Copyright 2013 The Apache Software Foundation
    002//
    003// Licensed under the Apache License, Version 2.0 (the "License");
    004// you may not use this file except in compliance with the License.
    005// You may obtain a copy of the License at
    006//
    007//     http://www.apache.org/licenses/LICENSE-2.0
    008//
    009// Unless required by applicable law or agreed to in writing, software
    010// distributed under the License is distributed on an "AS IS" BASIS,
    011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012// See the License for the specific language governing permissions and
    013// limitations under the License.
    014
    015package org.apache.tapestry5.corelib.data;
    016
    017/**
    018 * Possible values of the "secure" parameter for components that use a
    019 * {@link SelectModel} (such as {@link Select}), to control whether the submitted
    020 * value must be one of the values in the SelectModel.
    021 */
    022public enum SecureOption
    023{
    024    /**
    025     * Always check that the submitted value is found in the SelectModel (and
    026     * record a validation error if the SelectModel is not provided (null).
    027     */
    028    ALWAYS,
    029
    030    /**
    031     * Never check that submitted value is found in the SelectModel. It is left
    032     * to the user of the component to validate the submitted value.
    033     */
    034    NEVER,
    035
    036    /**
    037     * The default: check that the submitted value is found in the SelectModel,
    038     * unless the SelectModel is not provided (null) at the time of submission.
    039     * Since SelectModels are automatically provided for enums but not custom
    040     * classes, this is the most useful option in cases where you don't want to
    041     * persist a custom SelectModel across a form submission or recreate it
    042     * when the form is submitted).
    043     */
    044    AUTO;
    045}