Package org.hibernate.validator.internal.metadata.location

Examples of org.hibernate.validator.internal.metadata.location.ConstraintLocation


public class ConstraintLocationTest {

  @Test
  @TestForIssue(jiraKey = "HV-930")
  public void two_constraint_locations_for_the_same_type_should_be_equal() {
    ConstraintLocation location1 = ConstraintLocation.forClass( Foo.class );
    ConstraintLocation location2 = ConstraintLocation.forClass( Foo.class );

    assertEquals( location1, location2, "Two constraint locations for the same type should be equal" );
  }
View Full Code Here


  @Test
  @TestForIssue(jiraKey = "HV-930")
  public void two_constraint_locations_for_the_same_member_should_be_equal() throws Exception {
    Member member = Foo.class.getMethod( "getBar" );
    ConstraintLocation location1 = ConstraintLocation.forProperty( member );
    ConstraintLocation location2 = ConstraintLocation.forProperty( member );

    assertEquals( location1, location2, "Two constraint locations for the same type should be equal" );
  }
View Full Code Here

    Set<MetaConstraint<?>> crossParameterConstraints = newHashSet();
    if ( crossParameterType == null ) {
      return crossParameterConstraints;
    }

    ConstraintLocation constraintLocation = ConstraintLocation.forCrossParameter( executableElement );

    for ( ConstraintType constraintType : crossParameterType.getConstraint() ) {
      MetaConstraint<?> metaConstraint = MetaConstraintBuilder.buildMetaConstraint(
          constraintLocation,
          constraintType,
View Full Code Here

                        AnnotationProcessingOptionsImpl annotationProcessingOptions) {
    if ( returnValueType == null ) {
      return false;
    }

    ConstraintLocation constraintLocation = ConstraintLocation.forReturnValue( executableElement );
    for ( ConstraintType constraint : returnValueType.getConstraint() ) {
      MetaConstraint<?> metaConstraint = MetaConstraintBuilder.buildMetaConstraint(
          constraintLocation,
          constraint,
          executableElement.getElementType(),
View Full Code Here

    Set<ConstrainedExecutable> constrainedExecutables = newHashSet();
    List<String> alreadyProcessedGetterNames = newArrayList();
    for ( GetterType getterType : getterList ) {
      String getterName = getterType.getName();
      Method getter = findGetter( beanClass, getterName, alreadyProcessedGetterNames );
      ConstraintLocation constraintLocation = ConstraintLocation.forProperty( getter );

      Set<MetaConstraint<?>> metaConstraints = newHashSet();
      for ( ConstraintType constraint : getterType.getConstraint() ) {
        MetaConstraint<?> metaConstraint = MetaConstraintBuilder.buildMetaConstraint(
            constraintLocation,
View Full Code Here

  private void addConstrainedElements(Class<?> beanClass, Set<? extends ConstrainedElement> newConstrainedElements) {
    if ( constrainedElements.containsKey( beanClass ) ) {
      Set<ConstrainedElement> existingConstrainedElements = constrainedElements.get( beanClass );
      for ( ConstrainedElement constrainedElement : newConstrainedElements ) {
        if ( existingConstrainedElements.contains( constrainedElement ) ) {
          ConstraintLocation location = constrainedElement.getLocation();
          throw log.getConstrainedElementConfiguredMultipleTimesException( location.getMember().toString() );
        }
        else {
          existingConstrainedElements.add( constrainedElement );
        }
      }
View Full Code Here

  private void addConstrainedElements(Class<?> beanClass, Set<? extends ConstrainedElement> newConstrainedElements) {
    if ( constrainedElements.containsKey( beanClass ) ) {
      Set<ConstrainedElement> existingConstrainedElements = constrainedElements.get( beanClass );
      for ( ConstrainedElement constrainedElement : newConstrainedElements ) {
        if ( existingConstrainedElements.contains( constrainedElement ) ) {
          ConstraintLocation location = constrainedElement.getLocation();
          throw log.getConstrainedElementConfiguredMultipleTimesException(location.getMember().toString() );
        }
        else {
          existingConstrainedElements.add( constrainedElement );
        }
      }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.location.ConstraintLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.