All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.validation.metadata.ExecutableDescriptor Maven / Gradle / Ivy

The newest version!
/*
 * Bean Validation API
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or .
 */
package javax.validation.metadata;

import javax.validation.Valid;
import java.util.List;
import java.util.Set;

/**
 * Provides the common functionality of {@link MethodDescriptor} and
 * {@link ConstructorDescriptor}.
 *
 * @author Gunnar Morling
 *
 * @since 1.1
 */
public interface ExecutableDescriptor extends ElementDescriptor {

	/**
	 * Returns the method name in case this descriptor represents a method or
	 * the non-qualified name of the declaring class in case this descriptor
	 * represents a constructor.
	 *
	 * @return the name of the executable represented by this descriptor
	 */
	String getName();

	/**
	 * Returns a list of descriptors representing this executable's
	 * parameters, in the order of their declaration, including synthetic
	 * parameters.
	 *
	 * @return a list of descriptors representing this executable's
	 *         parameters; an empty list will be returned if this executable has
	 *         no parameters, but never {@code null}
	 */
	List getParameterDescriptors();

	/**
	 * Returns a descriptor containing the cross-parameter constraints
	 * of this executable.
	 *
	 * @return a descriptor containing the cross-parameter constraints of
	 *         this executable
	 */
	CrossParameterDescriptor getCrossParameterDescriptor();

	/**
	 * Returns a descriptor for this executable's return value.
	 * 

* An executable without return value will return a descriptor * representing {@code void}. This descriptor will have no constraint * associated. * * @return a descriptor for this executable's return value */ ReturnValueDescriptor getReturnValueDescriptor(); /** * Returns {@code true} if the executable parameters are constrained either: *

    *
  • because of a constraint on at least one of the parameters
  • *
  • because of a cascade on at least one of the parameters (via * {@link Valid})
  • *
  • because of at least one cross-parameter constraint
  • *
*

* Also returns {@code false} if there is no parameter. * * @return {@code true} if the executable parameters are constrained */ boolean hasConstrainedParameters(); /** * Returns {@code true} if the executable return value is constrained * either: *

    *
  • because of a constraint on the return value
  • *
  • because validation is cascaded on the return value (via * {@link Valid})
  • *
*

* Also returns {@code false} if there is no return value. * * @return {@code true} if the executable return value is constrained */ boolean hasConstrainedReturnValue(); /** * Returns {@code false}. *

* An executable per se does not host constraints, use * {@link #getParameterDescriptors()}, {@link #getCrossParameterDescriptor()} * and {@link #getReturnValueDescriptor()} to discover constraints. * * @return {@code false} */ @Override boolean hasConstraints(); /** * Returns an empty {@code Set}. *

* An executable per se does not host constraints, use * {@link #getParameterDescriptors()}, {@link #getCrossParameterDescriptor()} * and {@link #getReturnValueDescriptor()} to discover constraints. * * @return an empty {@code Set} */ @Override Set> getConstraintDescriptors(); /** * Returns a finder that will always return an empty {@code Set}. *

* An executable per se does not host constraints, use * {@link #getParameterDescriptors()}, {@link #getCrossParameterDescriptor()} * and {@link #getReturnValueDescriptor()} to discover constraints. * * @return {@code ConstraintFinder} object */ @Override ConstraintFinder findConstraints(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy