Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2010, Red Hat Middleware LLC, and individual contributors
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * 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 org.hibernate.validator.internal.metadata.raw;
 
 import java.util.List;
 import java.util.Set;
 
Represents a method of a Java type and all its associated meta-data relevant in the context of bean validation, for instance the constraints at it's parameters or return value.

Author(s):
Gunnar Morling
 
 public class ConstrainedMethod extends AbstractConstrainedElement {
 
 	private static final Log log = LoggerFactory.make();

Constrained-related meta data for this method's parameters.
 
 
 	private final boolean hasParameterConstraints;

Creates a new method meta data object for a parameter-less method.

Parameters:
source The source of meta data.
location The location of the represented method.
returnValueConstraints The return value constraints of the represented method, if any.
isCascading Whether a cascaded validation of the represented method's return value shall be performed or not.
 
 			Set<MetaConstraint<?>> returnValueConstraints,
 			boolean isCascading) {
 
 		this(
 				source,
 				location,
 				returnValueConstraints,
 				isCascading
 		);
 	}

Creates a new method meta data object.

Parameters:
source The source of meta data.
location The location of the represented method.
parameterMetaData A list with parameter meta data. The length must correspond with the number of parameters of the represented method. So this list may be empty (in case of a parameterless method), but never null.
returnValueConstraints The return value constraints of the represented method, if any.
isCascading Whether a cascaded validation of the represented method's return value shall be performed or not.
 
 			List<ConstrainedParameterparameterMetaData,
 			Set<MetaConstraint<?>> returnValueConstraints,
 			boolean isCascading) {
 
 		super(
 				source,
 				location,
 				returnValueConstraints,
 				isCascading
		);
		Method method = location.getMember();
		if ( parameterMetaData.size() != method.getParameterTypes().length ) {
					method,
					method.getParameterTypes().length,
					parameterMetaData.size()
			);
		}
		this. = Collections.unmodifiableListparameterMetaData );
		this. = hasParameterConstraintsparameterMetaData );
		if ( isConstrained() ) {
			ReflectionHelper.setAccessibilitymethod );
		}
	}
	private boolean hasParameterConstraints(List<ConstrainedParameterparameterMetaData) {
		for ( ConstrainedParameter oneParameter : parameterMetaData ) {
			if ( oneParameter.isConstrained() ) {
				return true;
			}
		}
		return false;
	}
	}

Constraint meta data for the specified parameter.

Parameters:
parameterIndex The index in this method's parameter array of the parameter of interest.
Returns:
Meta data for the specified parameter. Will never be null.
Throws:
java.lang.IllegalArgumentException In case this method doesn't have a parameter with the specified index.
	public ConstrainedParameter getParameterMetaData(int parameterIndex) {
		if ( parameterIndex < 0 || parameterIndex > .size() - 1 ) {
		}
		return .getparameterIndex );
	}

Returns meta data for all parameters of the represented method.

Returns:
A list with parameter meta data. The length corresponds to the number of parameters of the method represented by this meta data object, so an empty list may be returned (in case of a parameterless method), but never null.
	}

Whether the represented method is constrained or not. This is the case if it has at least one constrained parameter, at least one parameter marked for cascaded validation, at least one return value constraint or if the return value is marked for cascaded validation.

Returns:
True, if this method is constrained by any means, false otherwise.
	public boolean isConstrained() {
	}

Whether this method has at least one cascaded parameter or at least one parameter with constraints.

Returns:
True, if this method has at least one cascading or constrained parameter, false otherwise.
	public boolean hasParameterConstraints() {
	}

Whether the represented method is a JavaBeans getter method or not.

Returns:
True, if this method is a getter method, false otherwise.
	public boolean isGetterMethod() {
		return ReflectionHelper.isGetterMethodgetLocation().getMember() );
	}
	public String toString() {
		return "ConstrainedMethod [location=" + getLocation()
", parameterMetaData=" + 
", hasParameterConstraints=" +  + "]";
	}
New to GrepCode? Check out our FAQ X