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


Java PersistentEntity类代码示例

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


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

示例1: MybatisMetamodelEntityInformation

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
/**
 * Creates a new {@link AbstractEntityInformation} from the given domain class.
 *
 * @param domainClass must not be {@literal null}.
 */
protected MybatisMetamodelEntityInformation(PersistentEntity<T, ?> persistentEntity,
    AuditorAware<?> auditorAware, AuditDateAware<?> auditDateAware, Class<T> domainClass) {
  super(persistentEntity, auditorAware, auditDateAware, domainClass);

  createdDateProperty = persistentEntity.getPersistentProperty(CreatedDate.class);
  lastModifiedDateProperty = persistentEntity.getPersistentProperty(LastModifiedDate.class);
  createdByProperty = persistentEntity.getPersistentProperty(CreatedBy.class);
  lastModifiedByProperty = persistentEntity.getPersistentProperty(LastModifiedBy.class);
}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:15,代码来源:MybatisMetamodelEntityInformation.java

示例2: populateProperties

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
private void populateProperties(Class<?> domainType, BusinessEntity entity) {
    Map<String, EntityProperty> properties = new HashMap<>();
    final PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(domainType);
    JacksonMetadata jacksonMetadata = new JacksonMetadata(objectMapper, domainType);
    for (BeanPropertyDefinition definition : jacksonMetadata) {
        PersistentProperty<?> persistentProperty = persistentEntity.getPersistentProperty(definition.getInternalName());
        PropertyFactoryContext context = new PropertyFactoryContext(definition, jacksonMetadata, persistentProperty);
        PropertyFactory factory = getFactoryFor(context);
        if (factory != null) {
            EntityProperty property = factory.create(context);
            properties.put(definition.getInternalName(), property);
            if(property.isRequired()) {
                entity.getRequired().add(definition.getInternalName());
            }
        }
    }
    entity.setProperties(properties);
}
 
开发者ID:thomasletsch,项目名称:moserp,代码行数:19,代码来源:JsonSchemaBuilder.java

示例3: SimpleCratePersistentProperty

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
public SimpleCratePersistentProperty(Field field, PropertyDescriptor propertyDescriptor, 
									 PersistentEntity<?, CratePersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
	super(field, propertyDescriptor, owner, simpleTypeHolder);
	
	this.fieldNamingStrategy = INSTANCE;

	String fieldName = getFieldName();
	
	if(RESERVED_ID_FIELD_NAME.equals(fieldName)) {				
		throw new MappingException(format(RESERVED_ID, fieldName, owner.getType()));
	}
	
	if(RESERVED_VESRION_FIELD_NAME.equals(fieldName)) {				
		throw new MappingException(format(RESERVED_VERSION, fieldName, owner.getType()));
	}
	
	if(startsWithIgnoreCase(fieldName, "_")) {
		throw new MappingException(format(STARTS_WITH_UNDERSCORE, fieldName, owner.getType()));
	}
}
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:21,代码来源:SimpleCratePersistentProperty.java

示例4: update

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
@Override
public void update(Object objectToUpdate) {
    PersistentEntity<?, ? extends PersistentProperty> entity = this.mappingContext.getPersistentEntity(ClassUtils
            .getUserClass(objectToUpdate));

    if (!entity.hasIdProperty()) {
        throw new InvalidDataAccessApiUsageException(String.format("Cannot determine id for type %s",
                ClassUtils.getUserClass(objectToUpdate)));
    }

    update((Serializable) entity.getIdentifierAccessor(objectToUpdate).getIdentifier(), objectToUpdate);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:13,代码来源:TarantoolKeyValueTemplate.java

示例5: delete

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
@Override
public <T> T delete(T objectToDelete) {

    Class<T> type = (Class<T>) ClassUtils.getUserClass(objectToDelete);
    PersistentEntity<?, ? extends PersistentProperty> entity = this.mappingContext.getPersistentEntity(type);

    return delete((Serializable) entity.getIdentifierAccessor(objectToDelete).getIdentifier(), type);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:9,代码来源:TarantoolKeyValueTemplate.java

示例6: MybatisEntityInformationSupport

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
/**
 * Creates a new {@link AbstractEntityInformation} from the given domain class.
 *
 * @param auditDateAware
 * @param domainClass    must not be {@literal null}.
 */
protected MybatisEntityInformationSupport(
        PersistentEntity<T, ?> persistentEntity,
        AuditorAware<?> auditorAware,
        AuditDateAware<?> auditDateAware, Class<T> domainClass) {
    super(domainClass);
    this.persistentEntity = persistentEntity;
    this.auditorAware = auditorAware;
    this.auditDateAware = auditDateAware;
}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:16,代码来源:MybatisEntityInformationSupport.java

示例7: getEntityInformation

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
public static <T, ID extends Serializable> MybatisEntityInformation<T, ID> getEntityInformation(MybatisMappingContext mappingContext,
                                                                                                AuditorAware<?> auditorAware,
                                                                                                AuditDateAware<?> auditDateAware,
                                                                                                Class<T> domainClass) {
    Assert.notNull(domainClass);
    PersistentEntity<T, ?> persistentEntity = (PersistentEntity<T, ?>) mappingContext.getPersistentEntity(domainClass);
    if (Persistable.class.isAssignableFrom(domainClass)) {
        return new MybatisPersistableEntityInformation(persistentEntity, auditorAware, auditDateAware, domainClass);
    }

    return new MybatisMetamodelEntityInformation<T, ID>(persistentEntity, auditorAware, auditDateAware, domainClass);
}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:13,代码来源:MybatisEntityInformationSupport.java

示例8: DefaultVaultTypeMapper

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
private DefaultVaultTypeMapper(@Nullable String typeKey,
		TypeAliasAccessor<Map<String, Object>> accessor,
		MappingContext<? extends PersistentEntity<?, ?>, ?> mappingContext,
		List<? extends TypeInformationMapper> mappers) {

	super(accessor, mappingContext, mappers);

	this.typeKey = typeKey;
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:10,代码来源:DefaultVaultTypeMapper.java

示例9: getPersistentProperty

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
public static PersistentProperty<?> getPersistentProperty(PersistentEntity<?,?> entity, String propertyName) {
	
	PersistentProperty<?> prop = entity.getPersistentProperty(propertyName);
	if (null == prop)
		throw new ResourceNotFoundException();
	
	return prop;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:9,代码来源:PersistentEntityUtils.java

示例10: getContentPropertyDefinition

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
protected PersistentProperty<?> getContentPropertyDefinition(PersistentEntity<?, ?> persistentEntity, String contentProperty) {
	PersistentProperty<?> prop = persistentEntity.getPersistentProperty(contentProperty);
	if (null == prop)
		throw new ResourceNotFoundException();
	
	return prop;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:8,代码来源:AbstractContentPropertyController.java

示例11: buildProperties

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
private List<EntityProperty> buildProperties(Class<?> domainType) {
    List<EntityProperty> properties = new ArrayList<>();
    final PersistentEntity<?, ?> persistentEntity = persistentEntities.getPersistentEntity(domainType);
    JacksonMetadata jacksonMetadata = new JacksonMetadata(objectMapper, domainType);
    for (BeanPropertyDefinition definition : jacksonMetadata) {
        PersistentProperty<?> persistentProperty = persistentEntity.getPersistentProperty(definition.getInternalName());
        PropertyFactoryContext context = new PropertyFactoryContext(definition, jacksonMetadata, persistentProperty);
        PropertyFactory factory = getFactoryFor(context);
        if (factory != null) {
            properties.add(factory.create(context));
        }
    }
    return properties;
}
 
开发者ID:thomasletsch,项目名称:moserp,代码行数:15,代码来源:ApplicationStructureBuilder.java

示例12: setupMocks

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
public void setupMocks() throws URISyntaxException {
    configuration = mock(RepositoryRestConfiguration.class);
    when(configuration.getBaseUri()).thenReturn(new URI("http://localhost:8080/"));
    mappings = mock(ResourceMappings.class);
    metaData = mock(ResourceMetadata.class);
    when(metaData.getPath()).thenReturn(new Path("valueLists"));
    PersistentEntity persistentEntity = mock(PersistentEntity.class);
    when(persistentEntities.getPersistentEntity(any())).thenReturn(persistentEntity);
    PersistentProperty persistentProperty = mock(PersistentProperty.class);
    when(persistentEntity.getPersistentProperty(any(String.class))).thenReturn(persistentProperty);
    when(entityLinks.linkFor(any())).thenReturn(BaseUriLinkBuilder.create(new URI("http://localhost:8080/")));
    moduleRegistry = mock(ModuleRegistry.class);
    when(moduleRegistry.getBaseUriForResource(anyString())).thenReturn(new RestUri("http://localhost:8080/valueLists"));
}
 
开发者ID:thomasletsch,项目名称:moserp,代码行数:15,代码来源:ApplicationStructureBuilderTest.java

示例13: setupBasicMocks

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
@Before
public void setupBasicMocks() {
    jacksonMetadata = new JacksonMetadata(new ObjectMapperBuilder().build(), SimpleClass.class);
    persistentProperty = mock(PersistentProperty.class);

    persistentEntity = mock(PersistentEntity.class);
    when(persistentEntity.getType()).thenReturn(SimpleClass.class);
    when(persistentProperty.getOwner()).thenReturn(persistentEntity);
}
 
开发者ID:thomasletsch,项目名称:moserp,代码行数:10,代码来源:BasicPropertyFactoryTest.java

示例14: BasicCloudantPersistentProperty

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
public BasicCloudantPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, PersistentEntity<?, CloudantPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) {
    super(field, propertyDescriptor, owner, simpleTypeHolder);
    this.fieldNamingStrategy = fieldNamingStrategy == null ? PropertyNameFieldNamingStrategy.INSTANCE : fieldNamingStrategy;

    if (isIdProperty() && getFieldName() != ID_FIELD_NAME) {
        LOG.warn("Custom field name for id property is not supported!");
    }
}
 
开发者ID:SeniorAdvisor,项目名称:spring-data-cloudant,代码行数:9,代码来源:BasicCloudantPersistentProperty.java

示例15: getEntityInformation

import org.springframework.data.mapping.PersistentEntity; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {

	PersistentEntity<T, ?> entity = (PersistentEntity<T, ?>) context.getRequiredPersistentEntity(domainClass);

	return new PersistentEntityInformation<>(entity);
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:9,代码来源:KeyValueRepositoryFactory.java


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