com.sun.faces.component.validator.ComponentValidators Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jakarta.faces Show documentation
Show all versions of jakarta.faces Show documentation
EE4J Compatible Implementation for Jakarta Faces API
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.faces.component.validator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.sun.faces.facelets.tag.faces.ComponentSupport;
import com.sun.faces.util.RequestStateManager;
import jakarta.faces.application.Application;
import jakarta.faces.component.EditableValueHolder;
import jakarta.faces.context.FacesContext;
import jakarta.faces.validator.Validator;
import jakarta.faces.view.facelets.FaceletContext;
import jakarta.faces.view.facelets.ValidatorHandler;
/**
*
* This class is responsible for adding default validators and/or validators that wrap multiple
* EditableValueHolder
instances within the view.
*
*/
public class ComponentValidators {
/**
* Key within the FacesContext
's attribute map under which a single ComponentValidators
* instance will be stored.
*/
private static final String COMPONENT_VALIDATORS = "jakarta.faces.component.ComponentValidators";
/**
* Stack of ValidatorInfo instances. Each instance represents
* a particular nesting level within the view. As a nesting level is encountered,
* a ValidatorInfo
will be pushed to the stack and all EditableValueHolder
instances will be
* configured based on all ValidatorInfo
s on the stack. When the current nesting level is closed, the
* ValidatorInfo
instance will be popped and thus have no impact on other
* EditableValueHolder
s.
*/
private LinkedList validatorStack = null;
// ------------------------------------------------------------ Constructors
public ComponentValidators() {
validatorStack = new LinkedList<>();
}
// ---------------------------------------------------------- Public Methods
/**
* @param context the FacesContext
for the current request
* @param createIfNull flag indicating whether or not a ComponentValidators
instance should be created or
* not
* @return a ComponentValidators
instance for processing a view request. If createIfNull
is
* false
and no ComponentValidators
has been created, this method will return
* null
*/
public static ComponentValidators getValidators(FacesContext context, boolean createIfNull) {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy