Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2009, Red Hat, Inc. and/or its affiliates, 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.core;
 
 import java.util.Set;
 
Instances of this class abstract the constraint type (class, method or field constraint) and give access to meta data about the constraint. This allows a unified handling of constraints in the validator implementation.

Author(s):
Hardy Ferentschik
Gunnar Morling
 
 public class MetaConstraint<A extends Annotation> {

The constraint tree created from the constraint annotation.
 
 	private final ConstraintTree<A> constraintTree;

The constraint descriptor.
 
The location at which this constraint is defined.
 
 	private final ConstraintLocation location;

Parameters:
constraintDescriptor The constraint descriptor for this constraint
location meta data about constraint placement
 
 	public MetaConstraint(ConstraintDescriptorImpl<A> constraintDescriptorConstraintLocation location) {
 
 		this. = new ConstraintTree<A>( constraintDescriptor );
 		this. = constraintDescriptor;
 		this. = location;
 	}

Returns:
Returns the list of groups this constraint is part of. This might include the default group even when it is not explicitly specified, but part of the redefined default group list of the hosting bean.
 
 	public final Set<Class<?>> getGroupList() {
 	}
 
 	public final ConstraintDescriptorImpl<A> getDescriptor() {
 	}
 
 	public final ElementType getElementType() {
 	}
 
 	public boolean validateConstraint(ValidationContext<?, ?> executionContextValueContext<?, ?> valueContext) {
 		valueContext.setElementTypegetElementType() );
 
 		return .validateConstraintsexecutionContextvalueContext );
 	}
 
 		return ;
 	}
 
 	protected final Type typeOfAnnotatedElement() {
 	}

Parameters:
o the object from which to retrieve the value.
Returns:
Returns the value for this constraint from the specified object. Depending on the type either the value itself is returned of method or field access is used to access the value.
	public Object getValue(Object o) {
		if ( .getMember() == null ) {
			return o;
		}
		else {
			return ReflectionHelper.getValue.getMember(), o );
		}
	}
	public boolean equals(Object o) {
		if ( this == o ) {
			return true;
		}
		if ( o == null || getClass() != o.getClass() ) {
			return false;
		}
		MetaConstraint<?> that = (MetaConstraint<?>) o;
		if (  != null ? !.equalsthat.constraintDescriptor ) : that.constraintDescriptor != null ) {
			return false;
		}
		if (  != null ? !.equalsthat.location ) : that.location != null ) {
			return false;
		}
		return true;
	}
	public int hashCode() {
		int result =  != null ? .hashCode() : 0;
		result = 31 * result + (  != null ? .hashCode() : 0 );
		return result;
	}
	public String toString() {
		final StringBuilder sb = new StringBuilder();
		sb.append"MetaConstraint" );
		sb.append", location=" ).append );
		sb.append"}" );
		return sb.toString();
	}
New to GrepCode? Check out our FAQ X