org.springframework.data.mapping.Association.getInverse()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中org.springframework.data.mapping.Association.getInverse()方法的一些代码示例,展示了Association.getInverse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.getInverse()方法的具体详情如下:
包路径:org.springframework.data.mapping.Association
类名称:Association
方法名:getInverse

Association.getInverse介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
public MongoPersistentProperty getProperty() {
  return association == null ? property : association.getInverse();
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Creates a new {@link AssociationConverter} for the given {@link Association}.
 *
 * @param association must not be {@literal null}.
 */
public AssociationConverter(Association<MongoPersistentProperty> association) {
  Assert.notNull(association, "Association must not be null!");
  this.property = association.getInverse();
}

代码示例来源:origin: spring-projects/spring-data-mongodb

public void doWithAssociation(Association<MongoPersistentProperty> association) {
  assertUniqueness(association.getInverse());
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private void writeAssociation(Association<MongoPersistentProperty> association,
    PersistentPropertyAccessor<?> accessor, DocumentAccessor dbObjectAccessor) {
  MongoPersistentProperty inverseProp = association.getInverse();
  writePropertyInternal(accessor.getProperty(inverseProp), dbObjectAccessor, inverseProp);
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private void readAssociation(Association<MongoPersistentProperty> association, PersistentPropertyAccessor<?> accessor,
    DocumentAccessor documentAccessor, DbRefProxyHandler handler, DbRefResolverCallback callback) {
  MongoPersistentProperty property = association.getInverse();
  Object value = documentAccessor.get(property);
  if (value == null) {
    return;
  }
  DBRef dbref = value instanceof DBRef ? (DBRef) value : null;
  accessor.setProperty(property, dbRefResolver.resolveDbRef(property, dbref, callback, handler));
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private void resolveAndAddIndexesForAssociation(Association<MongoPersistentProperty> association,
    List<IndexDefinitionHolder> indexes, String path, String collection) {
  MongoPersistentProperty property = association.getInverse();
  String propertyDotPath = (StringUtils.hasText(path) ? path + "." : "") + property.getFieldName();
  if (property.isAnnotationPresent(GeoSpatialIndexed.class) || property.isAnnotationPresent(TextIndexed.class)) {
    throw new MappingException(
        String.format("Cannot create geospatial-/text- index on DBRef in collection '%s' for path '%s'.", collection,
            propertyDotPath));
  }
  IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(propertyDotPath, collection,
      property);
  if (indexDefinitionHolder != null) {
    indexes.add(indexDefinitionHolder);
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

String currentPath = !path.isEmpty() ? path + "." + association.getInverse().getName()
    : association.getInverse().getName();
if (association.getInverse().isCollectionLike()) {
  Collection<Object> target = CollectionFactory.createCollection(association.getInverse().getType(),
      association.getInverse().getComponentType(), bucket.size());
      target.add(read(association.getInverse().getActualType(), new RedisData(rawHash)));
  accessor.setProperty(association.getInverse(), target);
      accessor.setProperty(association.getInverse(),
          read(association.getInverse().getActualType(), new RedisData(rawHash)));

代码示例来源:origin: spring-projects/spring-data-redis

Object refObject = accessor.getProperty(association.getInverse());
if (refObject == null) {
  return;
if (association.getInverse().isCollectionLike()) {
      association.getInverse().getTypeInformation().getRequiredComponentType().getActualType());
  String propertyStringPath = (!path.isEmpty() ? path + "." : "") + association.getInverse().getName();
      .getRequiredPersistentEntity(association.getInverse().getTypeInformation());
  String keyspace = ref.getKeySpace();
    String propertyStringPath = (!path.isEmpty() ? path + "." : "") + association.getInverse().getName();
    sink.getBucket().put(propertyStringPath, toBytes(keyspace + ":" + refId));

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
public MongoPersistentProperty getProperty() {
  return association == null ? property : association.getInverse();
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

/**
 * Creates a new {@link AssociationConverter} for the given {@link Association}.
 *
 * @param association must not be {@literal null}.
 */
public AssociationConverter(Association<MongoPersistentProperty> association) {
  Assert.notNull(association, "Association must not be null!");
  this.property = association.getInverse();
}

代码示例来源:origin: spring-projects/spring-data-rest

/**
 * Returns whether the given {@link Association} is linkable.
 *
 * @param association must not be {@literal null}.
 * @return
 */
public boolean isLinkableAssociation(Association<? extends PersistentProperty<?>> association) {
  Assert.notNull(association, "Association must not be null!");
  return isLinkableAssociation(association.getInverse());
}

代码示例来源:origin: spring-projects/spring-data-rest

@Override
public void doWithAssociation(Association<? extends PersistentProperty<?>> association) {
  doWithPersistentProperty(association.getInverse());
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

public void doWithAssociation(Association<MongoPersistentProperty> association) {
  assertUniqueness(association.getInverse());
}

代码示例来源:origin: spring-projects/spring-data-redis

.getInverse().getTypeInformation().getRequiredComponentType().getActualType());
.getRequiredPersistentEntity(targetProperty.getRequiredAssociation().getInverse().getTypeInformation());

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private void writeAssociation(Association<MongoPersistentProperty> association,
    PersistentPropertyAccessor<?> accessor, DocumentAccessor dbObjectAccessor) {
  MongoPersistentProperty inverseProp = association.getInverse();
  writePropertyInternal(accessor.getProperty(inverseProp), dbObjectAccessor, inverseProp);
}

代码示例来源:origin: spring-projects/spring-data-rest

@Override
  public void doWithAssociation(Association<? extends PersistentProperty<?>> association) {
    if (associationLinks.isLinkableAssociation(association)) {
      return;
    }
    delegate.doWithPersistentProperty(association.getInverse());
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private void readAssociation(Association<MongoPersistentProperty> association, PersistentPropertyAccessor<?> accessor,
    DocumentAccessor documentAccessor, DbRefProxyHandler handler, DbRefResolverCallback callback) {
  MongoPersistentProperty property = association.getInverse();
  Object value = documentAccessor.get(property);
  if (value == null) {
    return;
  }
  DBRef dbref = value instanceof DBRef ? (DBRef) value : null;
  accessor.setProperty(property, dbRefResolver.resolveDbRef(property, dbref, callback, handler));
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private void resolveAndAddIndexesForAssociation(Association<MongoPersistentProperty> association,
    List<IndexDefinitionHolder> indexes, String path, String collection) {
  MongoPersistentProperty property = association.getInverse();
  String propertyDotPath = (StringUtils.hasText(path) ? path + "." : "") + property.getFieldName();
  if (property.isAnnotationPresent(GeoSpatialIndexed.class) || property.isAnnotationPresent(TextIndexed.class)) {
    throw new MappingException(
        String.format("Cannot create geospatial-/text- index on DBRef in collection '%s' for path '%s'.", collection,
            propertyDotPath));
  }
  IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(propertyDotPath, collection,
      property);
  if (indexDefinitionHolder != null) {
    indexes.add(indexDefinitionHolder);
  }
}

代码示例来源:origin: spring-projects/spring-data-rest

@Override
  public void doWithAssociation(final Association<? extends PersistentProperty<?>> association) {
    if (associationLinks.isLinkableAssociation(association)) {
      PersistentProperty<?> property = association.getInverse();
      Links existingLinks = new Links(links);
      for (Link link : associationLinks.getLinksFor(association, basePath)) {
        if (existingLinks.hasLink(link.getRel())) {
          throw new MappingException(String.format(AMBIGUOUS_ASSOCIATIONS, property.toString()));
        } else {
          links.add(link);
        }
      }
    }
  }
}

代码示例来源:origin: spring-projects/spring-data-rest

@Override
  public void doWithAssociation(final Association<? extends PersistentProperty<?>> association) {

    PersistentProperty<?> property = association.getInverse();

    if (associations.isLinkableAssociation(property)) {

      Links existingLinks = new Links(links);

      for (Link link : associations.getLinksFor(association, basePath)) {
        if (existingLinks.hasLink(link.getRel())) {
          throw new MappingException(String.format(AMBIGUOUS_ASSOCIATIONS, property.toString()));
        } else {
          links.add(link);
        }
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多