/** * Creates a new {@link MetadataBackedField} with the given name, {@link MongoPersistentEntity} and * {@link MappingContext} with the given {@link MongoPersistentProperty}. * * @param name must not be {@literal null} or empty. * @param entity must not be {@literal null}. * @param context must not be {@literal null}. * @param property may be {@literal null}. */ public MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context, @Nullable MongoPersistentProperty property) { super(name); Assert.notNull(entity, "MongoPersistentEntity must not be null!"); this.entity = entity; this.mappingContext = context; this.path = getPath(name); this.property = path == null ? property : path.getLeafProperty(); this.association = findAssociation(); }
/** * Creates a new {@link MetadataBackedField} with the given name, {@link MongoPersistentEntity} and * {@link MappingContext} with the given {@link MongoPersistentProperty}. * * @param name must not be {@literal null} or empty. * @param entity must not be {@literal null}. * @param context must not be {@literal null}. * @param property may be {@literal null}. */ public MetadataBackedField(String name, MongoPersistentEntity<?> entity, MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> context, @Nullable MongoPersistentProperty property) { super(name); Assert.notNull(entity, "MongoPersistentEntity must not be null!"); this.entity = entity; this.mappingContext = context; this.path = getPath(name); this.property = path == null ? property : path.getLeafProperty(); this.association = findAssociation(); }