public class PersistentEntities extends Object implements Streamable<PersistentEntity<?,? extends PersistentProperty<?>>>
PersistentEntity
instances managed by MappingContext
s.Constructor and Description |
---|
PersistentEntities(Iterable<? extends MappingContext<?,?>> contexts)
Creates a new
PersistentEntities for the given MappingContext s. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
and, empty, filter, flatMap, get, isEmpty, map, of, of, of, stream
forEach, spliterator
public PersistentEntities(Iterable<? extends MappingContext<?,?>> contexts)
PersistentEntities
for the given MappingContext
s.contexts
- public static PersistentEntities of(MappingContext<?,?>... contexts)
PersistentEntities
for the given MappingContext
s.contexts
- must not be null.public Optional<PersistentEntity<?,? extends PersistentProperty<?>>> getPersistentEntity(Class<?> type)
PersistentEntity
for the given type. Will consider all MappingContext
s registered but
return Optional#empty() in case none of the registered ones already have a PersistentEntity
registered for the given type.type
- can be null.public PersistentEntity<?,? extends PersistentProperty<?>> getRequiredPersistentEntity(Class<?> type)
PersistentEntity
for the given type. Will consider all MappingContext
s registered but
throw an IllegalArgumentException
in case none of the registered ones already have a
PersistentEntity
registered for the given type.type
- must not be null.PersistentEntity
for the given domain type.IllegalArgumentException
- in case no PersistentEntity
can be found for the given type.public <T> Optional<T> mapOnContext(Class<?> type, BiFunction<MappingContext<?,? extends PersistentProperty<?>>,PersistentEntity<?,?>,T> combiner)
BiFunction
on the given MappingContext
and PersistentEntity
based on the
given type.type
- must not be null.combiner
- must not be null.public Streamable<TypeInformation<?>> getManagedTypes()
TypeInformation
exposed by the registered MappingContext
s.public Iterator<PersistentEntity<?,? extends PersistentProperty<?>>> iterator()
iterator
in interface Iterable<PersistentEntity<?,? extends PersistentProperty<?>>>
@Nullable public PersistentEntity<?,?> getEntityUltimatelyReferredToBy(PersistentProperty<?> property)
PersistentEntity
the given PersistentProperty
refers to in case it's an association.
For direct aggregate references, that's simply the entity for the PersistentProperty
's actual type. If the
property type is not an entity - as it might rather refer to the identifier type - we either use the reference's
defined target type and fall back to trying to find a PersistentEntity
identified by the
PersistentProperty
's actual type.property
- must not be null.public TypeInformation<?> getTypeUltimatelyReferredToBy(PersistentProperty<?> property)
PersistentProperty
ultimately refers to. In case it's of a unique identifier
type of an entity known it'll return the entity type.property
- must not be null.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.