本文整理汇总了Java中org.springframework.data.mapping.PersistentPropertyAccessor类的典型用法代码示例。如果您正苦于以下问题:Java PersistentPropertyAccessor类的具体用法?Java PersistentPropertyAccessor怎么用?Java PersistentPropertyAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentPropertyAccessor类属于org.springframework.data.mapping包,在下文中一共展示了PersistentPropertyAccessor类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readProperties
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
private void readProperties(VaultPersistentEntity<?> entity,
PersistentPropertyAccessor accessor,
@Nullable VaultPersistentProperty idProperty,
SecretDocumentAccessor documentAccessor,
VaultPropertyValueProvider valueProvider) {
for (VaultPersistentProperty prop : entity) {
// we skip the id property since it was already set
if (idProperty != null && idProperty.equals(prop)) {
continue;
}
if (entity.isConstructorArgument(prop) || !documentAccessor.hasValue(prop)) {
continue;
}
accessor.setProperty(prop, valueProvider.getPropertyValue(prop));
}
}
开发者ID:spring-projects,项目名称:spring-vault,代码行数:21,代码来源:MappingVaultConverter.java
示例2: writeInternal
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
protected void writeInternal(Object obj, SecretDocumentAccessor sink,
VaultPersistentEntity<?> entity) {
PersistentPropertyAccessor accessor = entity.getPropertyAccessor(obj);
VaultPersistentProperty idProperty = entity.getIdProperty();
if (idProperty != null && !sink.hasValue(idProperty)) {
Object value = accessor.getProperty(idProperty);
if (value != null) {
sink.put(idProperty, value);
}
}
writeProperties(entity, accessor, sink, idProperty);
}
开发者ID:spring-projects,项目名称:spring-vault,代码行数:17,代码来源:MappingVaultConverter.java
示例3: writeProperties
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
private void writeProperties(VaultPersistentEntity<?> entity,
PersistentPropertyAccessor accessor, SecretDocumentAccessor sink,
@Nullable VaultPersistentProperty idProperty) {
// Write the properties
for (VaultPersistentProperty prop : entity) {
if (prop.equals(idProperty) || !prop.isWritable()) {
continue;
}
Object value = accessor.getProperty(prop);
if (value == null) {
continue;
}
if (!conversions.isSimpleType(value.getClass())) {
writePropertyInternal(value, sink, prop);
}
else {
sink.put(prop, getPotentiallyConvertedSimpleWrite(value));
}
}
}
开发者ID:spring-projects,项目名称:spring-vault,代码行数:27,代码来源:MappingVaultConverter.java
示例4: setContentProperty
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
protected void setContentProperty(Object domainObj, PersistentProperty<?> property, String contentId, Object newValue) {
PersistentPropertyAccessor accessor = property.getOwner().getPropertyAccessor(domainObj);
Object contentPropertyObject = accessor.getProperty(property);
if (contentPropertyObject == null)
return;
else if (!PersistentEntityUtils.isPropertyMultiValued(property)) {
accessor.setProperty(property, newValue);
} else {
// handle multi-valued
if (property.isArray()) {
throw new UnsupportedOperationException();
} else if (property.isCollectionLike() && contentPropertyObject instanceof Set) {
@SuppressWarnings("unchecked")
Set<Object> contentSet = (Set<Object>)contentPropertyObject;
Object oldValue = findContentPropertyObjectInSet(contentId, contentSet);
contentSet.remove(oldValue);
if (newValue != null)
contentSet.add(newValue);
}
}
}
开发者ID:paulcwarren,项目名称:spring-content,代码行数:23,代码来源:AbstractContentPropertyController.java
示例5: getContentProperty
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
protected Object getContentProperty(Object domainObj, PersistentProperty<?> property, String contentId) {
PersistentPropertyAccessor accessor = property.getOwner().getPropertyAccessor(domainObj);
Object contentPropertyObject = accessor.getProperty(property);
// multi-valued property?
if (PersistentEntityUtils.isPropertyMultiValued(property)) {
if (property.isArray()) {
throw new UnsupportedOperationException();
} else if (property.isCollectionLike()) {
contentPropertyObject = findContentPropertyObjectInSet(contentId, (Collection<?>)contentPropertyObject);
}
}
if (contentPropertyObject == null) {
throw new ResourceNotFoundException();
}
if (BeanUtils.hasFieldWithAnnotation(contentPropertyObject, ContentId.class)) {
if (BeanUtils.getFieldWithAnnotation(contentPropertyObject, ContentId.class) == null) {
throw new ResourceNotFoundException();
}
}
return contentPropertyObject;
}
开发者ID:paulcwarren,项目名称:spring-content,代码行数:27,代码来源:AbstractContentPropertyController.java
示例6: read
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
private <S extends Object> S read(final SolrPersistentEntity<S> entity, final Map<String, ?> source, Object parent) {
ParameterValueProvider<SolrPersistentProperty> parameterValueProvider = getParameterValueProvider(entity, source,
parent);
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
final S instance = instantiator.createInstance(entity, parameterValueProvider);
final PersistentPropertyAccessor accessor = new ConvertingPropertyAccessor(entity.getPropertyAccessor(instance),
getConversionService());
entity.doWithProperties(new PropertyHandler<SolrPersistentProperty>() {
@Override
public void doWithPersistentProperty(SolrPersistentProperty persistentProperty) {
if (entity.isConstructorArgument(persistentProperty)) {
return;
}
Object o = getValue(persistentProperty, source, instance);
if (o != null) {
accessor.setProperty(persistentProperty, o);
}
}
});
return instance;
}
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:27,代码来源:MappingSolrConverter.java
示例7: delete
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
public <T> Mutation delete(Class<T> entityClass, Iterable<? extends T> entities) {
final BasicSpannerPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entityClass);
KeySet.Builder builder = KeySet.newBuilder();
for (T entity : entities) {
final PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(entity);
SpannerPersistentProperty idProperty = persistentEntity.getIdProperty();
Object value = accessor.getProperty(idProperty);
builder.addKey(Key.of(value));
}
return Mutation.delete(persistentEntity.tableName(), builder.build());
}
开发者ID:saturnism,项目名称:spring-data-spanner,代码行数:12,代码来源:SpannerMutationFactory.java
示例8: createMutation
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
public <T> Mutation createMutation(Mutation.Op op, T object, String... properties) {
final Set<String> includeProperties = new HashSet<>(Arrays.asList(properties));
final Class<?> entityType = object.getClass();
final BasicSpannerPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(object.getClass());
final Mutation.WriteBuilder writeBuilder = writeBuilder(op, persistentEntity.tableName());
final PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(object);
persistentEntity.doWithProperties(new PropertyHandler<SpannerPersistentProperty>() {
@Override
public void doWithPersistentProperty(SpannerPersistentProperty spannerPersistentProperty) {
if (!spannerPersistentProperty.isIdProperty() && op == Mutation.Op.UPDATE && !includeProperties.contains(spannerPersistentProperty.getName())) {
return;
}
Object value = accessor.getProperty(spannerPersistentProperty);
Class<?> propertyType = spannerPersistentProperty.getType();
ValueBinder<Mutation.WriteBuilder> set = writeBuilder.set(spannerPersistentProperty.getColumnName());
if (String.class.isAssignableFrom(propertyType)) {
set.to((String) value);
} else if (Boolean.class.isAssignableFrom(propertyType)) {
set.to((Boolean) value);
} else if (Date.class.isAssignableFrom(propertyType)) {
set.to((Date) value);
} else if (Double.class.isAssignableFrom(propertyType)) {
set.to((Double) value);
} else if (Long.class.isAssignableFrom(propertyType)) {
set.to((Long) value);
} else if (Timestamp.class.isAssignableFrom(propertyType)) {
set.to((Timestamp) value);
} else {
throw new SpannerDataException(String.format("Unsupported mapping for type: %s", value.getClass()));
}
}
});
return writeBuilder.build();
}
开发者ID:saturnism,项目名称:spring-data-spanner,代码行数:35,代码来源:SpannerMutationFactory.java
示例9: increaseVersion
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
@Override
public int increaseVersion(T entity) {
PersistentProperty<?> versionProperty = persistentEntity.getVersionProperty();
if (null == versionProperty) {
return 0;
}
PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(entity);
int newVer = (Integer) accessor.getProperty(versionProperty) + 1;
accessor.setProperty(versionProperty, newVer);
return newVer;
}
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:14,代码来源:MybatisMetamodelEntityInformation.java
示例10: read
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
private <S> S read(VaultPersistentEntity<S> entity, SecretDocument source) {
ParameterValueProvider<VaultPersistentProperty> provider = getParameterProvider(
entity, source);
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
S instance = instantiator.createInstance(entity, provider);
PersistentPropertyAccessor accessor = new ConvertingPropertyAccessor(
entity.getPropertyAccessor(instance), conversionService);
VaultPersistentProperty idProperty = entity.getIdProperty();
SecretDocumentAccessor documentAccessor = new SecretDocumentAccessor(source);
// make sure id property is set before all other properties
Object idValue;
if (idProperty != null && documentAccessor.hasValue(idProperty)) {
idValue = readIdValue(idProperty, documentAccessor);
accessor.setProperty(idProperty, idValue);
}
VaultPropertyValueProvider valueProvider = new VaultPropertyValueProvider(
documentAccessor);
readProperties(entity, accessor, idProperty, documentAccessor, valueProvider);
return instance;
}
开发者ID:spring-projects,项目名称:spring-vault,代码行数:30,代码来源:MappingVaultConverter.java
示例11: GeneratingIdAccessor
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
/**
* Creates a new {@link GeneratingIdAccessor} using the given {@link PersistentPropertyAccessor}, identifier property
* and {@link IdentifierGenerator}.
*
* @param accessor must not be {@literal null}.
* @param identifierProperty must not be {@literal null}.
* @param generator must not be {@literal null}.
*/
GeneratingIdAccessor(PersistentPropertyAccessor accessor, PersistentProperty<?> identifierProperty,
IdentifierGenerator generator) {
Assert.notNull(accessor, "PersistentPropertyAccessor must not be null!");
Assert.notNull(identifierProperty, "Identifier property must not be null!");
Assert.notNull(generator, "IdentifierGenerator must not be null!");
this.accessor = accessor;
this.identifierProperty = identifierProperty;
this.generator = generator;
}
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:20,代码来源:GeneratingIdAccessor.java
示例12: getPropertyAccessor
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
private ConvertingPropertyAccessor getPropertyAccessor(Object entity) {
final DocumentDbPersistentEntity<?> entityInformation = mappingContext.getPersistentEntity(entity.getClass());
final PersistentPropertyAccessor accessor = entityInformation.getPropertyAccessor(entity);
return new ConvertingPropertyAccessor(accessor, conversionService);
}
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:6,代码来源:MappingDocumentDbConverter.java
示例13: map
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
public void map(Struct s, Object target) {
Class<?> entityType = target.getClass();
BasicSpannerPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(target.getClass());
PersistentPropertyAccessor accessor = persistentEntity.getPropertyAccessor(target);
for (Type.StructField field : s.getType().getStructFields()) {
String name = field.getName();
SpannerPersistentProperty property = persistentEntity.getPersistentPropertyByColumnName(name);
if (s.isNull(name)) {
if (property.getType().isPrimitive()) {
// TODO probably not good to do this anyways...
// TODO or maybe throw an error?
}
else { accessor.setProperty(property, null); }
continue;
}
switch (field.getType().getCode()) {
case ARRAY:
switch (field.getType().getArrayElementType().getCode()) {
// TODO: implement all ARRAY types
case BOOL:
if (property.getActualType().isArray())
accessor.setProperty(property, s.getBooleanArray(name));
else
accessor.setProperty(property, s.getBooleanList(name));
break;
}
break;
case BOOL:
accessor.setProperty(property, s.getBoolean(name));
break;
case BYTES:
break;
case DATE:
accessor.setProperty(property, s.getDate(name));
break;
case FLOAT64:
accessor.setProperty(property, s.getDouble(name));
break;
case INT64:
accessor.setProperty(property, s.getLong(name));
break;
case STRING:
accessor.setProperty(property, s.getString(name));
break;
case TIMESTAMP:
accessor.setProperty(property, s.getTimestamp(name));
break;
case STRUCT:
break;
}
}
}
开发者ID:saturnism,项目名称:spring-data-spanner,代码行数:54,代码来源:SpannerStructObjectMapper.java
示例14: writeInternal
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
/**
* @param path
* @param value
* @param typeHint
* @param sink
*/
private void writeInternal(final Path path, final Object value, TypeInformation<?> typeHint,
final TarantoolData sink) {
if (value == null) {
sink.getTuple().set(path, null);
return;
}
if (value.getClass() != typeHint.getType()) {
sink.getTuple().set((!path.isEmpty() ? Path.concat(path, TYPE_HINT_INDEX) : Path.of(TYPE_HINT_INDEX)), value.getClass().getName());
}
final TarantoolPersistentEntity<?> entity = mappingContext.getPersistentEntity(value.getClass());
final PersistentPropertyAccessor accessor = entity.getPropertyAccessor(value);
entity.doWithProperties(new PropertyHandler<TarantoolPersistentProperty>() {
@Override
public void doWithPersistentProperty(TarantoolPersistentProperty persistentProperty) {
final OptionalInt optTupleIndex = persistentProperty.getTupleIndex();
if(!optTupleIndex.isPresent()) {
// Do not write property without tuple index
return;
}
final int tupleIndex = optTupleIndex.getAsInt();
Path propertyPath = (!path.isEmpty() ? Path.concat(path, tupleIndex) : Path.of(tupleIndex));
if (persistentProperty.isIdProperty()) {
sink.getTuple().set(propertyPath, accessor.getProperty(persistentProperty));
return;
}
if (persistentProperty.isCollectionLike()) {
final Object property = accessor.getProperty(persistentProperty);
if (property == null || Iterable.class.isAssignableFrom(property.getClass())) {
writeCollection(propertyPath, (Iterable<?>) property,
persistentProperty.getTypeInformation().getComponentType(), sink);
} else if (property.getClass().isArray()) {
writeCollection(propertyPath, CollectionUtils.arrayToList(property),
persistentProperty.getTypeInformation().getComponentType(), sink);
} else {
throw new RuntimeException("Don't know how to handle " + property.getClass() + " type collection");
}
} else if (persistentProperty.isEntity()) {
writeInternal(propertyPath, accessor.getProperty(persistentProperty),
persistentProperty.getTypeInformation().getActualType(), sink);
} else {
Object propertyValue = accessor.getProperty(persistentProperty);
writeToBucket(propertyPath, propertyValue, sink, persistentProperty.getType());
}
}
});
}
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:66,代码来源:MappingTarantoolConverter.java
示例15: delete
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
@StoreType("contentstore")
@RequestMapping(value = BASE_MAPPING, method = RequestMethod.DELETE, headers = "accept!=application/hal+json")
public void delete(HttpServletRequest request,
HttpServletResponse response,
@PathVariable String repository,
@PathVariable String id,
@PathVariable String contentProperty)
throws HttpRequestMethodNotSupportedException {
Object domainObj = findOne(repositories, repository, id);
PersistentEntity<?,?> entity = repositories.getPersistentEntity(domainObj.getClass());
if (null == entity) {
response.setStatus(HttpStatus.NOT_FOUND.value());
return;
}
PersistentProperty<?> property = this.getContentPropertyDefinition(entity, contentProperty);
if (PersistentEntityUtils.isPropertyMultiValued(property)) {
response.setStatus(HttpStatus.METHOD_NOT_ALLOWED.value());
return;
}
PersistentPropertyAccessor accessor = property.getOwner().getPropertyAccessor(domainObj);
Object propVal = accessor.getProperty(property);
if (propVal == null) {
response.setStatus(HttpStatus.NOT_FOUND.value());
return;
}
if (!BeanUtils.hasFieldWithAnnotation(propVal,ContentId.class)) {
response.setStatus(HttpStatus.NOT_FOUND.value(), "Missing @ContentId");
return;
}
ContentStoreInfo info = ContentStoreUtils.findContentStore(storeService, propVal.getClass());
if (info == null)
throw new IllegalStateException(String.format("Unable to find a content store for %s", repository));
info.getImplementation(ContentStore.class).unsetContent(propVal);
if (BeanUtils.hasFieldWithAnnotation(propVal, MimeType.class)) {
BeanUtils.setFieldWithAnnotation(propVal, MimeType.class, null);
}
save(repositories, domainObj);
response.setStatus(HttpStatus.NO_CONTENT.value());
return;
}
开发者ID:paulcwarren,项目名称:spring-content,代码行数:51,代码来源:ContentPropertyCollectionRestController.java
示例16: writeInternal
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
/**
* @param keyspace
* @param path
* @param value
* @param typeHint
* @param sink
*/
private void writeInternal(final String keyspace, final String path, final Object value, TypeInformation<?> typeHint,
final RedisData sink) {
if (value == null) {
return;
}
if (value.getClass() != typeHint.getType()) {
sink.addDataEntry(toBytes((!path.isEmpty() ? path + "._class" : "_class")), toBytes(value.getClass().getName()));
}
final KeyValuePersistentEntity<?> entity = mappingContext.getPersistentEntity(value.getClass());
final PersistentPropertyAccessor accessor = entity.getPropertyAccessor(value);
entity.doWithProperties(new PropertyHandler<KeyValuePersistentProperty>() {
@Override
public void doWithPersistentProperty(KeyValuePersistentProperty persistentProperty) {
String propertyStringPath = (!path.isEmpty() ? path + "." : "") + persistentProperty.getName();
if (persistentProperty.isIdProperty()) {
sink.addDataEntry(toBytes(persistentProperty.getName()), toBytes(accessor.getProperty(persistentProperty)));
return;
}
if (persistentProperty.isMap()) {
writeMap(keyspace, propertyStringPath, persistentProperty.getMapValueType(),
(Map<?, ?>) accessor.getProperty(persistentProperty), sink);
} else if (persistentProperty.isCollectionLike()) {
writeCollection(keyspace, propertyStringPath, (Collection<?>) accessor.getProperty(persistentProperty),
persistentProperty.getTypeInformation().getComponentType(), sink);
} else if (persistentProperty.isEntity()) {
writeInternal(keyspace, propertyStringPath, accessor.getProperty(persistentProperty), persistentProperty
.getTypeInformation().getActualType(), sink);
} else {
if (indexConfiguration.hasIndexFor(entity.getKeySpace(), persistentProperty.getName())) {
// TODO: check all index types and add accordingly
sink.addSimpleIndexKey(toBytes(persistentProperty.getName() + ":"
+ accessor.getProperty(persistentProperty)));
}
else if (persistentProperty.isAnnotationPresent(Indexed.class)) {
// TOOD: read index type from annotation
indexConfiguration.addIndexDefinition(new RedisIndexDefinition(entity.getKeySpace(), persistentProperty
.getName(), IndexType.SIMPLE));
sink.addSimpleIndexKey(toBytes(persistentProperty.getName() + ":"
+ accessor.getProperty(persistentProperty)));
}
sink.addDataEntry(toBytes(propertyStringPath), toBytes(accessor.getProperty(persistentProperty)));
}
}
});
writeAssiciation(keyspace, path, entity, value, sink);
}
开发者ID:christophstrobl,项目名称:spring-data-keyvalue-redis,代码行数:69,代码来源:MappingRedisConverter.java
示例17: write
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
protected void write(Object source, final Map target, SolrPersistentEntity<?> entity) {
final PersistentPropertyAccessor accessor = new ConvertingPropertyAccessor(entity.getPropertyAccessor(source),
getConversionService());
entity.doWithProperties(new PropertyHandler<SolrPersistentProperty>() {
@SuppressWarnings("unchecked")
@Override
public void doWithPersistentProperty(SolrPersistentProperty persistentProperty) {
Object value = accessor.getProperty(persistentProperty);
if (value == null || persistentProperty.isReadonly()) {
return;
}
if (persistentProperty.containsWildcard() && !persistentProperty.isMap()) {
throw new IllegalArgumentException("Field '" + persistentProperty.getFieldName()
+ "' must not contain wildcards. Consider excluding Field from beeing indexed.");
}
Collection<SolrInputField> fields;
if (persistentProperty.isMap() && persistentProperty.containsWildcard()) {
fields = writeWildcardMapPropertyToTarget(target, persistentProperty, (Map<?, ?>) value);
} else {
fields = writeRegularPropertyToTarget(target, persistentProperty, value);
}
if (persistentProperty.isBoosted()) {
for (SolrInputField field : fields) {
field.setBoost(persistentProperty.getBoost());
}
}
}
});
if (entity.isBoosted() && target instanceof SolrInputDocument) {
((SolrInputDocument) target).setDocumentBoost(entity.getBoost());
}
}
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:43,代码来源:MappingSolrConverter.java
示例18: read
import org.springframework.data.mapping.PersistentPropertyAccessor; //导入依赖的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
注:本文中的org.springframework.data.mapping.PersistentPropertyAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论