本文整理汇总了Java中org.springframework.data.repository.core.EntityInformation类的典型用法代码示例。如果您正苦于以下问题:Java EntityInformation类的具体用法?Java EntityInformation怎么用?Java EntityInformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityInformation类属于org.springframework.data.repository.core包,在下文中一共展示了EntityInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@Override
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
if (source == null || !StringUtils.hasText(source.toString())) {
return null;
}
// if (sourceType.equals(targetType)) {
if (isTypesEqual(sourceType, targetType)) {
return source;
}
Class<?> domainType = sourceType.getType();
EntityInformation<Object, ?> entityInformation = repositories.getEntityInformationFor(domainType);
return conversionService.convert(entityInformation.getId(source), targetType.getType());
}
示例2: BaseJdbcRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
public BaseJdbcRepository(EntityInformation<T, ID> entityInformation, RowMapper<T> rowMapper,
RowUnmapper<T> rowUnmapper, TableDescription table) {
Assert.notNull(rowMapper);
Assert.notNull(table);
this.entityInfo = entityInformation != null ? entityInformation : createEntityInformation();
this.rowUnmapper = rowUnmapper != null ? rowUnmapper : new UnsupportedRowUnmapper<T>();
this.rowMapper = rowMapper;
this.table = table;
}
示例3: createEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private EntityInformation<T, ID> createEntityInformation() {
Class<T> entityType = (Class<T>) GenericTypeResolver.resolveTypeArguments(getClass(),
JdbcRepository.class)[0];
return createEntityInformation(entityType);
}
示例4: chooseStrategy
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
public static <T, ID extends Serializable> AbstractRepositoryStrategy chooseStrategy(EntityInformation<T, ID> entityInformation) {
switch (EntityUtils.getEntityType(entityInformation)) {
case AUTO_INCREMENTAL:
return new AutoIncrementRepositoryStrategy(entityInformation);
case MANUALLY_ASSIGNED:
return new ManuallyAssignedRepositoryStrategy(entityInformation);
case READ_ONLY:
return new ReadOnlyRepositoryStrategy(entityInformation);
default:
throw new IllegalArgumentException("Don't know what strategy to instantiate");
}
}
示例5: getEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
TarantoolPersistentEntity<T> entity = ((TarantoolPersistentEntity<T>) keyValueOperations
.getMappingContext()
.getPersistentEntity(domainClass));
EntityInformation<T, ID> entityInformation = (EntityInformation<T, ID>) new MappingTarantoolEntityInformation<T>(entity);
return entityInformation;
}
示例6: getEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
MongoPersistentEntity<T> persistentEntity = (MongoPersistentEntity<T>) mappingContext.getPersistentEntity(domainClass);
return new MappingMongoEntityInformation<>(persistentEntity, config);
}
示例7: SimpleGcloudDatastoreRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
public SimpleGcloudDatastoreRepository(EntityInformation<T, ID> entityInformation,
DatastoreOptions datastoreOptions) {
Assert.notNull(entityInformation, "EntityInformation must not be null!");
this.entityInformation = entityInformation;
this.kind = entityInformation.getJavaType().getSimpleName();
this.datastoreOptions = datastoreOptions;
}
示例8: getTargetRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@Override
protected Object getTargetRepository(RepositoryInformation information) {
EntityInformation<?, Serializable> entityInformation = getEntityInformation(
information.getDomainType());
return getTargetRepositoryViaReflection(information, entityInformation,
this.datastoreOptions);
}
示例9: SimpleObjectifyRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
public SimpleObjectifyRepository(EntityInformation<T, ID> metadata) {
this.metadata = metadata;
Class<ID> idType = metadata.getIdType();
if ((idType != String.class) && (idType != Long.class)){
throw new RuntimeException("Id Type must be String or Long");
}
}
示例10: getEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
VaultPersistentEntity<T> entity = (VaultPersistentEntity<T>) operations
.getMappingContext().getPersistentEntity(domainClass);
return new MappingVaultEntityInformation<>(entity);
}
示例11: getEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
return new AbstractEntityInformation<T, ID>(domainClass) {
@Override public ID getId(T entity) {
return null;
}
@Override public Class<ID> getIdType() {
return null;
}
};
}
示例12: SimpleKeyValueRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
/**
* Creates a new {@link SimpleKeyValueRepository} for the given {@link EntityInformation} and
* {@link KeyValueOperations}.
*
* @param metadata must not be {@literal null}.
* @param operations must not be {@literal null}.
*/
public SimpleKeyValueRepository(EntityInformation<T, ID> metadata, KeyValueOperations operations) {
Assert.notNull(metadata, "EntityInformation must not be null!");
Assert.notNull(operations, "KeyValueOperations must not be null!");
this.entityInformation = metadata;
this.operations = operations;
}
示例13: QuerydslKeyValueRepository
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
/**
* Creates a new {@link QuerydslKeyValueRepository} for the given {@link EntityInformation},
* {@link KeyValueOperations} and {@link EntityPathResolver}.
*
* @param entityInformation must not be {@literal null}.
* @param operations must not be {@literal null}.
* @param resolver must not be {@literal null}.
*/
public QuerydslKeyValueRepository(EntityInformation<T, ID> entityInformation, KeyValueOperations operations,
EntityPathResolver resolver) {
super(entityInformation, operations);
Assert.notNull(resolver, "EntityPathResolver must not be null!");
EntityPath<T> path = resolver.createPath(entityInformation.getJavaType());
this.builder = new PathBuilder<>(path.getType(), path.getMetadata());
}
示例14: getEntityInformation
import org.springframework.data.repository.core.EntityInformation; //导入依赖的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);
}
示例15: getEntityInfo
import org.springframework.data.repository.core.EntityInformation; //导入依赖的package包/类
protected EntityInformation<T, ID> getEntityInfo() {
return entityInfo;
}