use of org.springframework.data.mapping.SimpleAssociationHandler in project spring-data-commons by spring-projects.
the class ClassGeneratingPropertyAccessorFactory method hasUniquePropertyHashCodes.
private boolean hasUniquePropertyHashCodes(PersistentEntity<?, ?> entity) {
Set<Integer> hashCodes = new HashSet<>();
AtomicInteger propertyCount = new AtomicInteger();
entity.doWithProperties((SimplePropertyHandler) property -> {
hashCodes.add(property.getName().hashCode());
propertyCount.incrementAndGet();
});
entity.doWithAssociations((SimpleAssociationHandler) association -> {
if (association.getInverse() != null) {
hashCodes.add(association.getInverse().getName().hashCode());
propertyCount.incrementAndGet();
}
});
return hashCodes.size() == propertyCount.get();
}
Aggregations