本文整理汇总了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);
}
示例2: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<DocumentDbPersistentProperty> createAssociation() {
return new Association<>(this, null);
}
示例3: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SpannerPersistentProperty> createAssociation() {
return new Association<SpannerPersistentProperty>(this, null);
}
示例4: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<TarantoolPersistentProperty> createAssociation() {
return new Association<>(this, null);
}
示例5: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SnowdropPersistentProperty> createAssociation() {
return null;
}
示例6: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<MongoPersistentProperty> createAssociation() {
return new Association<>(this, null);
}
示例7: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<ObjectifyPersistentProperty> createAssociation() {
return new Association<ObjectifyPersistentProperty>(this, null);
}
示例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();
}
示例9: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<SolrPersistentProperty> createAssociation() {
return null;
}
示例10: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<CloudantPersistentProperty> createAssociation() {
return new Association<CloudantPersistentProperty>(this, null);
}
示例11: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<CratePersistentProperty> createAssociation() {
throw new UnsupportedOperationException("@Reference is not supported!");
}
示例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;
}
示例13: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Association<P> createAssociation() {
return new Association<>((P) this, null);
}
示例14: createAssociation
import org.springframework.data.mapping.Association; //导入依赖的package包/类
@Override
protected Association<DynamoDBPersistentProperty> createAssociation() {
return new Association<DynamoDBPersistentProperty>(this, null);
}