javax.validation

Interface Validator


  • public interface Validator
    Validates bean instances. Implementations of this interface must be thread-safe.
    Author:
    Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling
    • Method Detail

      • validate

        <T> Set<ConstraintViolation<T>> validate(T object,
                                                 Class<?>... groups)
        Validates all constraints on object.
        Parameters:
        object - object to validate
        groups - the group or list of groups targeted for validation (defaults to Default)
        Returns:
        constraint violations or an empty set if none
        Throws:
        IllegalArgumentException - if object is null or if null is passed to the varargs groups
        ValidationException - if a non recoverable error happens during the validation process
      • validateProperty

        <T> Set<ConstraintViolation<T>> validateProperty(T object,
                                                         String propertyName,
                                                         Class<?>... groups)
        Validates all constraints placed on the property of object named propertyName.
        Parameters:
        object - object to validate
        propertyName - property to validate (i.e. field and getter constraints)
        groups - the group or list of groups targeted for validation (defaults to Default)
        Returns:
        constraint violations or an empty set if none
        Throws:
        IllegalArgumentException - if object is null, if propertyName is null, empty or not a valid object property or if null is passed to the varargs groups
        ValidationException - if a non recoverable error happens during the validation process
      • getConstraintsForClass

        BeanDescriptor getConstraintsForClass(Class<?> clazz)
        Returns the descriptor object describing bean constraints.

        The returned object (and associated objects including ConstraintDescriptors) are immutable.

        Parameters:
        clazz - class or interface type evaluated
        Returns:
        the bean descriptor for the specified class
        Throws:
        IllegalArgumentException - if clazz is null
        ValidationException - if a non recoverable error happens during the metadata discovery or if some constraints are invalid.
      • unwrap

        <T> T unwrap(Class<T> type)
        Returns an instance of the specified type allowing access to provider-specific APIs.

        If the Bean Validation provider implementation does not support the specified class, ValidationException is thrown.

        Parameters:
        type - the class of the object to be returned
        Returns:
        an instance of the specified class
        Throws:
        ValidationException - if the provider does not support the call
      • forExecutables

        ExecutableValidator forExecutables()
        Returns the contract for validating parameters and return values of methods and constructors.
        Returns:
        contract for method and constructor validation
        Since:
        1.1

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/validation/validator.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.