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, and, and, and, empty, filter, flatMap, get, isEmpty, map, of, of, of, stream, toList, toSet, toStreamable, toStreamable
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.MappingContext.hasPersistentEntityFor(Class)
,
MappingContext.getPersistentEntity(Class)
public PersistentEntity<?,? extends PersistentProperty<?>> getRequiredPersistentEntity(Class<?> type)
PersistentEntity
for the given type. Will consider all MappingContext
s registered and
create a new PersistentEntity
in case none of the registered ones already have it registered for the given
type, if there is only one context available.type
- must not be null.PersistentEntity
for the given domain type.MappingException
- if the PersistentEntity
cannot be found or
created
by the underlying MappingContext
.MappingContext.getRequiredPersistentEntity(Class)
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. Considers all MappingContext
s for lookup. This method will create a new
PersistentEntity
in case there is only a single MappingContext
registered.type
- must not be null.combiner
- must not be null.BiFunction
.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–2020 Pivotal Software, Inc.. All rights reserved.