DATACMNS-1101 - Remove getPersistentProperties/Associations from PersistentEntity.
Remove lately introduced getPersistentProperties / getAssociations and rather extend Iterable<? extends PersistentProperty<P>>
This commit is contained in:
committed by
Oliver Gierke
parent
88ac1fc165
commit
f6a6565638
@@ -31,7 +31,7 @@ import org.springframework.data.util.TypeInformation;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
public interface PersistentEntity<T, P extends PersistentProperty<P>> {
|
||||
public interface PersistentEntity<T, P extends PersistentProperty<P>> extends Iterable<P> {
|
||||
|
||||
/**
|
||||
* The entity name including any package prefix.
|
||||
@@ -224,14 +224,6 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> {
|
||||
|
||||
void doWithProperties(SimplePropertyHandler handler);
|
||||
|
||||
/**
|
||||
* Get {@link Iterable}
|
||||
*
|
||||
* @return
|
||||
* @since 2.0
|
||||
*/
|
||||
Iterable<P> getPersistentProperties();
|
||||
|
||||
/**
|
||||
* Applies the given {@link AssociationHandler} to all {@link Association} contained in this {@link PersistentEntity}.
|
||||
*
|
||||
@@ -241,8 +233,6 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> {
|
||||
|
||||
void doWithAssociations(SimpleAssociationHandler handler);
|
||||
|
||||
Iterable<Association<P>> getAssociations();
|
||||
|
||||
/**
|
||||
* Looks up the annotation of the given type on the {@link PersistentEntity}.
|
||||
*
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -353,15 +354,6 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentEntity#getPersistentProperties()
|
||||
*/
|
||||
@Override
|
||||
public List<P> getPersistentProperties() {
|
||||
return Collections.unmodifiableList(persistentPropertiesCache);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentEntity#doWithAssociations(org.springframework.data.mapping.AssociationHandler)
|
||||
@@ -388,15 +380,6 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentEntity#getAssociations()
|
||||
*/
|
||||
@Override
|
||||
public Set<Association<P>> getAssociations() {
|
||||
return Collections.unmodifiableSet(associations);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentEntity#findAnnotation(java.lang.Class)
|
||||
@@ -471,6 +454,11 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
return hasIdProperty() ? new IdPropertyIdentifierAccessor(this, bean) : new AbsentIdentifierAccessor(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<P> iterator() {
|
||||
return Collections.unmodifiableList(properties).iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the {@link Alias} to be used for the given type.
|
||||
*
|
||||
|
||||
@@ -155,7 +155,7 @@ public class AbstractMappingContextUnitTests {
|
||||
|
||||
assertThat(entity.getPersistentProperty("persons"))
|
||||
.satisfies(it -> assertThat(mappingContext.getPersistentEntity(it))
|
||||
.satisfies(inner -> assertThat(inner.getType()).isEqualTo(Person.class)));
|
||||
.satisfies(inner -> assertThat(((PersistentEntity)inner).getType()).isEqualTo(Person.class)));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-380
|
||||
|
||||
Reference in New Issue
Block a user