当前位置: 首页>>代码示例>>Java>>正文


Java Association类代码示例

本文整理汇总了Java中org.springframework.data.mapping.Association的典型用法代码示例。如果您正苦于以下问题:Java Association类的具体用法?Java Association怎么用?Java Association使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Association类属于org.springframework.data.mapping包,在下文中一共展示了Association类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<MybatisPersistentProperty> createAssociation() {
    if (null != findAnnotation(Embedded.class)) {
        return new MybatisEmbeddedAssociation(this, null);
    }

    if (null != findAnnotation(ManyToOne.class)) {
        return new MybatisManyToOneAssociation(this, null);
    }
    if (null != findAnnotation(OneToOne.class)) {
        return new MybatisOneToOneAssociation(this, null);
    }

    if (null != findAnnotation(OneToMany.class)) {
        return new MybatisOneToManyAssociation(this, null);
    }

    if (null != findAnnotation(ManyToMany.class)) {
        return new MybatisManyToManyAssociation(this, null);
    }

    return new MybatisAssociation(this, null);

}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:25,代码来源:MybatisPersistentPropertyImpl.java

示例2: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<DocumentDbPersistentProperty> createAssociation() {
    return new Association<>(this, null);
}
 
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:5,代码来源:BasicDocumentDbPersistentProperty.java

示例3: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SpannerPersistentProperty> createAssociation() {
  return new Association<SpannerPersistentProperty>(this, null);
}
 
开发者ID:saturnism,项目名称:spring-data-spanner,代码行数:5,代码来源:BasicSpannerPersistentProperty.java

示例4: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<TarantoolPersistentProperty> createAssociation() {
    return new Association<>(this, null);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:5,代码来源:TarantoolPersistentPropertyImpl.java

示例5: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SnowdropPersistentProperty> createAssociation() {
  return null;
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:5,代码来源:SimpleSnowdropPersistentProperty.java

示例6: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<MongoPersistentProperty> createAssociation() {
	return new Association<>(this, null);
}
 
开发者ID:wesley-ramos,项目名称:spring-multitenancy,代码行数:5,代码来源:BasicMongoPersistentProperty.java

示例7: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<ObjectifyPersistentProperty> createAssociation() {
    return new Association<ObjectifyPersistentProperty>(this, null);
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:5,代码来源:ObjectifyPersistentProperty.java

示例8: buildQueryCondition

import org.springframework.data.mapping.Association; //导入依赖的package包/类
private String buildQueryCondition(boolean basic) {

        StringBuilder builder = new StringBuilder();
        builder.append("<trim prefix=\" where \" prefixOverrides=\"and |or \">");
        int c = 0;
        for (Iterator<PartTree.OrPart> iterator = tree.iterator(); iterator.hasNext(); ) {
            PartTree.OrPart orPart = iterator.next();
            builder.append(" or (");
            builder.append("<trim prefix=\"\" prefixOverrides=\"and |or \">");

            for (Iterator<Part> it = orPart.iterator(); it.hasNext(); ) {
                String columnName = null;
                Part part = it.next();
                MybatisPersistentProperty property = persistentEntity.getPersistentProperty(part.getProperty().getSegment());
                if (null == property) {
                    throw new MybatisQueryException("can not find property: " + part.getProperty().getSegment() + " from entity: " + persistentEntity.getName());
                }
                if (!property.isEntity()) {
                    columnName = quota(persistentEntity.getEntityName()) + "." + dialect.wrapColumnName(property.getColumnName());
                } else if (!basic) {
                    if (property.isAssociation()) {
                        Association<MybatisPersistentProperty> ass = property.getAssociation();
                        if (ass instanceof MybatisManyToOneAssociation) {
                            MybatisManyToOneAssociation association = (MybatisManyToOneAssociation) ass;

                            MybatisPersistentEntity<?> obversePersistentEntity = association.getObversePersistentEntity();
                            if (null == obversePersistentEntity) {
                                throw new MybatisQueryException("can not find obverse persistent entity.");
                            }

                            PropertyPath leaf = part.getProperty().getLeafProperty();

                            if (obversePersistentEntity.getType() == leaf.getType()) {

                                //columnName = quota(persistentEntity.getEntityName() + "." + part.getProperty().getSegment()) + "." + dialect.wrapColumnName(obversePersistentEntity.getIdProperty().getColumnName());
                                throw new UnsupportedOperationException("findBy{Association Model} Style is not support now.");

                            } else {
                                MybatisPersistentProperty leafProperty = obversePersistentEntity.getPersistentProperty(leaf.getSegment());
                                if (null == leafProperty) {
                                    throw new MybatisQueryException("can not find property: " + leaf.getSegment() + " from entity: " + obversePersistentEntity.getName());
                                }
                                columnName = quota(persistentEntity.getEntityName() + "." + part.getProperty().getSegment()) + "." + dialect.wrapColumnName(leafProperty.getColumnName());
                            }
                        } else if (ass instanceof MybatisEmbeddedAssociation) {
                            columnName = quota(persistentEntity.getEntityName()) + "." + dialect.wrapColumnName(ass.getObverse().getColumnName());
                        }
                    }
                }

                if (null == columnName) {
                    throw new MybatisQueryException("can not find property: " + part.getProperty().getSegment() + " in " + method.getName());
                }

                builder.append(" and ");

                IgnoreCaseType ignoreCaseType = part.shouldIgnoreCase();
                if (ignoreCaseType == ALWAYS || ignoreCaseType == WHEN_POSSIBLE) {
                    builder.append("upper(").append(columnName).append(")");
                } else {
                    builder.append(columnName);
                }

                builder.append(generator.buildConditionOperate(part.getType()));
                String[] properties = new String[part.getType().getNumberOfArguments()];
                for (int i = 0; i < properties.length; i++) {
                    properties[i] = resolveParameterName(c++);
                }
                builder.append(generator.buildConditionCaluse(part.getType(), ignoreCaseType, properties));
            }

            builder.append("</trim>");

            builder.append(" )");

        }
        builder.append("</trim>");
        return builder.toString();
    }
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:80,代码来源:PartTreeMybatisQuery.java

示例9: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SolrPersistentProperty> createAssociation() {
	return null;
}
 
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:5,代码来源:SimpleSolrPersistentProperty.java

示例10: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<CloudantPersistentProperty> createAssociation() {
    return new Association<CloudantPersistentProperty>(this, null);
}
 
开发者ID:SeniorAdvisor,项目名称:spring-data-cloudant,代码行数:5,代码来源:BasicCloudantPersistentProperty.java

示例11: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<CratePersistentProperty> createAssociation() {
	throw new UnsupportedOperationException("@Reference is not supported!");
}
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:5,代码来源:SimpleCratePersistentProperty.java

示例12: read

import org.springframework.data.mapping.Association; //导入依赖的package包/类
/**
 * Read an incoming {@link CrateDocument} into the target entity.
 *
 * @param entity the target entity.
 * @param source the document to convert.
 * @param parent an optional parent object.
 * @param <R> the entity type.
 * @return the converted entity.
 */
@SuppressWarnings("unchecked")
protected <R> R read(final CratePersistentEntity<R> entity, final CrateDocument source, final Object parent) {
	
	final DefaultSpELExpressionEvaluator evaluator = new DefaultSpELExpressionEvaluator(source, spELContext);
	
    ParameterValueProvider<CratePersistentProperty> provider = getParameterProvider(entity, source, evaluator, parent);
    
    EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);

    R instance = instantiator.createInstance(entity, provider);
    final PersistentPropertyAccessor propertyAccessor = entity.getPropertyAccessor(instance);
    final R result = (R)propertyAccessor.getBean();
    final CratePersistentProperty idProperty = entity.getIdProperty();
    final CratePersistentProperty versionProperty = entity.getVersionProperty();
    
    if(entity.hasIdProperty()) {
    	Object idValue = getValueInternal(idProperty, source, result);
    	propertyAccessor.setProperty(idProperty, idValue);
    }
    
    if(entity.hasVersionProperty()) {
    	Object versionValue = getValueInternal(versionProperty, source, result);
    	propertyAccessor.setProperty(versionProperty, versionValue);
    }
    
    for(CratePersistentProperty property : entity.getPersistentProperties()) {
    	// skip id and version properties as they may have potentially been set above.  
		if((idProperty != null && idProperty.equals(property)) || (versionProperty != null && versionProperty.equals(property))) {
			continue;
		}
		
		if(!source.containsKey(property.getFieldName()) || entity.isConstructorArgument(property)) {
			continue;
		}
		
		propertyAccessor.setProperty(property, getValueInternal(property, source, result));
    }
    
    entity.doWithAssociations(new AssociationHandler<CratePersistentProperty>() {
    	
      @Override
      public void doWithAssociation(final Association<CratePersistentProperty> association) {	    	  
    	  CratePersistentProperty inverseProp = association.getInverse();
    	  Object obj = getValueInternal(inverseProp, source, result);
    	  propertyAccessor.setProperty(inverseProp, obj);
      }	      
    });

    return result;
  }
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:60,代码来源:MappingCrateConverter.java

示例13: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Association<P> createAssociation() {
	return new Association<>((P) this, null);
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:6,代码来源:KeyValuePersistentProperty.java

示例14: createAssociation

import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<DynamoDBPersistentProperty> createAssociation() {
	return new Association<DynamoDBPersistentProperty>(this, null);
}
 
开发者ID:michaellavelle,项目名称:spring-data-dynamodb,代码行数:5,代码来源:DynamoDBPersistentPropertyImpl.java


注:本文中的org.springframework.data.mapping.Association类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。