Package org.hibernate.validator.internal.util

Examples of org.hibernate.validator.internal.util.IdentitySet


    }
    return true;
  }

  private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
    IdentitySet objectsProcessedInCurrentGroups = processedBeansPerGroup.get( group );
    return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
  }
View Full Code Here


  private void markCurrentBeanAsProcessedForCurrentGroup(Object value, Class<?> group) {
    if ( processedBeansPerGroup.containsKey( group ) ) {
      processedBeansPerGroup.get( group ).add( value );
    }
    else {
      IdentitySet set = new IdentitySet();
      set.add( value );
      processedBeansPerGroup.put( group, set );
    }
  }
View Full Code Here

public class IdentitySetTest {

  @SuppressWarnings("unchecked")
  @Test
  public void testAddIdenticalInstance() {
    Set identitySet = new IdentitySet();
    Set hashSet = new HashSet();
    assertTrue( identitySet.size() == 0 );
    assertTrue( hashSet.size() == 0 );

    Object o1 = new Object() {
      int counter = 0;

      public int hashCode() {
        return counter++;
      }

      public boolean equals() {
        return false;
      }
    };
    identitySet.add( o1 );
    hashSet.add( o1 );
    assertTrue( identitySet.size() == 1 );
    assertTrue( hashSet.size() == 1 );

    identitySet.add( o1 );
    hashSet.add( o1 );
    assertTrue( identitySet.size() == 1 );
    assertTrue( hashSet.size() == 2 );

    Object o2 = new Object() {
      int counter = 0;

      public int hashCode() {
        return counter++;
      }

      public boolean equals() {
        return false;
      }
    };
    identitySet.add( o2 );
    hashSet.add( o2 );
    assertTrue( identitySet.size() == 2 );
    assertTrue( hashSet.size() == 3 );
  }
View Full Code Here

    }
    return true;
  }

  private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
    IdentitySet objectsProcessedInCurrentGroups = processedBeansPerGroup.get( group );
    return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
  }
View Full Code Here

  private void markCurrentBeanAsProcessedForCurrentGroup(Object value, Class<?> group) {
    if ( processedBeansPerGroup.containsKey( group ) ) {
      processedBeansPerGroup.get( group ).add( value );
    }
    else {
      IdentitySet set = new IdentitySet();
      set.add( value );
      processedBeansPerGroup.put( group, set );
    }
  }
View Full Code Here

    }
  }

  public boolean hasMetaConstraintBeenProcessed(Object bean, Path path, MetaConstraint<?> metaConstraint) {
    // TODO switch to proper multi key map (HF)
    IdentitySet processedConstraints = processedMetaConstraints.get( new BeanAndPath( bean, path ) );
    return processedConstraints != null && processedConstraints.contains( metaConstraint );
  }
View Full Code Here

    BeanAndPath beanAndPath = new BeanAndPath( bean, path );
    if ( processedMetaConstraints.containsKey( beanAndPath ) ) {
      processedMetaConstraints.get( beanAndPath ).add( metaConstraint );
    }
    else {
      IdentitySet set = new IdentitySet();
      set.add( metaConstraint );
      processedMetaConstraints.put( beanAndPath, set );
    }
  }
View Full Code Here

    }
    return true;
  }

  private boolean isAlreadyValidatedForCurrentGroup(Object value, Class<?> group) {
    final IdentitySet objectsProcessedInCurrentGroups = processedObjects.get( group );
    return objectsProcessedInCurrentGroups != null && objectsProcessedInCurrentGroups.contains( value );
  }
View Full Code Here

  private void markProcessForCurrentGroup(Object value, Class<?> group) {
    if ( processedObjects.containsKey( group ) ) {
      processedObjects.get( group ).add( value );
    }
    else {
      IdentitySet set = new IdentitySet();
      set.add( value );
      processedObjects.put( group, set );
    }
  }
View Full Code Here

    }
  }

  public boolean hasMetaConstraintBeenProcessed(Object bean, Path path, MetaConstraint<?> metaConstraint) {
    // TODO switch to proper multi key map (HF)
    IdentitySet processedConstraints = processedMetaConstraints.get( new BeanAndPath( bean, path ) );
    return processedConstraints != null && processedConstraints.contains( metaConstraint );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.util.IdentitySet

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.