Java 类org.springframework.data.repository.core.EntityInformation 实例源码

项目:iVIS    文件:IdToDomainClassConverter.java   
@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());
        }
项目:spring-data-jdbc    文件:BaseJdbcRepository.java   
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;
}
项目:spring-data-jdbc    文件:BaseJdbcRepository.java   
@SuppressWarnings("unchecked")
private EntityInformation<T, ID> createEntityInformation() {

    Class<T> entityType = (Class<T>) GenericTypeResolver.resolveTypeArguments(getClass(),
                                                                              JdbcRepository.class)[0];

    return createEntityInformation(entityType);
}
项目:spring-data-jdbc    文件:BaseJdbcRepository.java   
@SuppressWarnings({"rawtypes", "unchecked"})
protected static EntityInformation createEntityInformation(Class<?> entityType) {

    if (Persistable.class.isAssignableFrom(entityType)) {
        return new PersistableEntityInformation(entityType);
    }
    return new ReflectionEntityInformation(entityType);
}
项目:spring-data-jdbc    文件:RepositoryStrategyFactory.java   
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");
    }

}
项目:spring-data-tarantool    文件:TarantoolRepositoryFactory.java   
@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;
}
项目:spring-multitenancy    文件:MongoRepositoryFactory.java   
@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);
}
项目:spring-data-gclouddatastore    文件:SimpleGcloudDatastoreRepository.java   
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;
}
项目:spring-data-gclouddatastore    文件:GcloudDatastoreRepositoryFactory.java   
@Override
protected Object getTargetRepository(RepositoryInformation information) {
    EntityInformation<?, Serializable> entityInformation = getEntityInformation(
            information.getDomainType());
    return getTargetRepositoryViaReflection(information, entityInformation,
            this.datastoreOptions);
}
项目:spring-data-objectify    文件:SimpleObjectifyRepository.java   
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");
    }
}
项目:spring-vault    文件:VaultRepositoryFactory.java   
@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);
}
项目:ignite    文件:IgniteRepositoryFactory.java   
/** {@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;
        }
    };
}
项目:spring-data-keyvalue    文件:SimpleKeyValueRepository.java   
/**
 * 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;
}
项目:spring-data-keyvalue    文件:QuerydslKeyValueRepository.java   
/**
 * 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());
}
项目:spring-data-keyvalue    文件:KeyValueRepositoryFactory.java   
@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);
}
项目:spring-data-jdbc    文件:BaseJdbcRepository.java   
protected EntityInformation<T, ID> getEntityInfo() {
    return entityInfo;
}
项目:spring-data-jdbc    文件:EntityUtils.java   
public static <T, ID extends Serializable> EntityType getEntityType(EntityInformation<T, ID> information) {
    if (information instanceof JdbcEntityInformation) {
        return ((JdbcEntityInformation<T, ID>) information).getEntityType();
    }
    throw new RuntimeException("Don't know how to retrieve entity type");
}
项目:spring-data-jdbc    文件:ManuallyAssignedRepositoryStrategy.java   
ManuallyAssignedRepositoryStrategy(final EntityInformation entityInformation) {
    super(entityInformation);
}
项目:spring-data-jdbc    文件:AbstractRepositoryStrategy.java   
public AbstractRepositoryStrategy(final EntityInformation entityInformation) {
    this.entityInformation = entityInformation;
}
项目:spring-data-jdbc    文件:AbstractRepositoryStrategy.java   
protected EntityInformation getEntityInformation() {
    return entityInformation;
}
项目:spring-data-jdbc    文件:ReadOnlyRepositoryStrategy.java   
ReadOnlyRepositoryStrategy(final EntityInformation entityInformation) {
    super(entityInformation);
}
项目:spring-data-jdbc    文件:AutoIncrementRepositoryStrategy.java   
public AutoIncrementRepositoryStrategy(final EntityInformation entityInformation) {
    super(entityInformation);
    idSetter = getIdSetter();
    getNumberValueMethod = GeneratedValueUtil.getNumberConversionMethod(entityInformation.getIdType());
}
项目:spring-data-jdbc    文件:JdbcRepositoryFactory.java   
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
    return extractRepositoryField(repository, FIELD_ENTITY_INFO);
}
项目:spring-data-documentdb    文件:DocumentDbRepositoryFactory.java   
@Override
protected Object getTargetRepository(RepositoryInformation information) {
    final EntityInformation<?, Serializable> entityInformation = getEntityInformation(information.getDomainType());
    return getTargetRepositoryViaReflection(information, entityInformation, this.applicationContext);
}
项目:spring-data-documentdb    文件:DocumentDbRepositoryFactory.java   
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
    return new DocumentDbEntityInformation<T, ID>(domainClass);
}
项目:spring-data-documentdb    文件:DocumentDbRepositoryFactoryUnitTest.java   
@Test
public void useMappingDocumentDBEntityInfoIfMappingContextSet() {
    final DocumentDbRepositoryFactory factory = new DocumentDbRepositoryFactory(dbTemplate, applicationContext);
    final EntityInformation<Person, String> entityInfo = factory.getEntityInformation(Person.class);
    assertTrue(entityInfo instanceof DocumentDbEntityInformation);
}
项目:spring-data-snowdrop    文件:DatasourceMapperTester.java   
@Override
public <U, ID> CrudAdapter<U, ID> createCrudAdapter(EntityInformation<U, ID> ei) {
    return new TesterCrudAdapter<>(ei);
}
项目:spring-data-snowdrop    文件:DatasourceMapperTester.java   
public TesterCrudAdapter(EntityInformation<U, ID> entityInformation) {
    super(entityInformation);
}
项目:spring-data-snowdrop    文件:GaeCrudAdapter.java   
public GaeCrudAdapter(EntityInformation<T, ID> ei, EntityToModelMapper entityToModelMapper) {
    this.entityInformation = ei;
    this.entityToModelMapper = entityToModelMapper;
}
项目:spring-data-snowdrop    文件:GaeDatasourceMapper.java   
public <T, ID> CrudAdapter<T, ID> createCrudAdapter(EntityInformation<T, ID> ei) {
    return new GaeCrudAdapter<>(ei, entityToModelMapper);
}
项目:spring-data-snowdrop    文件:InfinispanEmbeddedDatasourceMapper.java   
public <T, ID> CrudAdapter<T, ID> createCrudAdapter(EntityInformation<T, ID> ei) {
    Cache<ID, T> cache = getCache(ei.getJavaType());
    return new InfinispanEmbeddedCrudAdapter<>(ei, cache);
}
项目:spring-data-snowdrop    文件:InfinispanEmbeddedDatasourceMapper.java   
public InfinispanEmbeddedCrudAdapter(EntityInformation<T, ID> ei, Cache<ID, T> cache) {
    super(ei, cache);
    this.cache = cache;
}
项目:spring-data-snowdrop    文件:InfinispanRemoteCrudAdapter.java   
public InfinispanRemoteCrudAdapter(EntityInformation<T, ID> ei, RemoteCache<ID, T> cache) {
    super(ei, cache);
    this.cache = cache;
}
项目:spring-data-snowdrop    文件:InfinispanRemoteDatasourceMapper.java   
public <T, ID> CrudAdapter<T, ID> createCrudAdapter(EntityInformation<T, ID> ei) {
    RemoteCache<ID, T> cache = getCache(ei.getJavaType());
    return new InfinispanRemoteCrudAdapter<T, ID>(ei, cache);
}
项目:spring-data-snowdrop    文件:MapCrudAdapter.java   
public MapCrudAdapter(EntityInformation<T, ID> entityInformation, Map<ID, T> map) {
    super(entityInformation);
    this.map = map;
}
项目:spring-data-snowdrop    文件:AbstractCrudAdapter.java   
public AbstractCrudAdapter(EntityInformation<T, ID> entityInformation) {
    this.entityInformation = entityInformation;
}
项目:spring-data-snowdrop    文件:SnowdropRepositoryFactory.java   
@Override
public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
    PersistentEntity<?, SnowdropPersistentProperty> persistentEntity =
        snowdropOperations.getMappingContext().getPersistentEntity(domainClass);
    return new MappingSnowdropEntityInformation(persistentEntity);
}
项目:spring-data-snowdrop    文件:JpaDatasourceMapper.java   
public <T, ID> CrudAdapter<T, ID> createCrudAdapter(EntityInformation<T, ID> ei) {
    return new OrmCrudAdapter<>(ei.getJavaType());
}
项目:spring-data-gclouddatastore    文件:GcloudDatastoreRepositoryFactory.java   
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(
        Class<T> domainClass) {

    return new GcloudDatastoreEntityInformation<T, ID>(domainClass);
}
项目:spring-data-jdbc-template    文件:JdbcTemplateRepositoryFactoryBean.java   
@Override
public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
    return new ReflectionEntityInformation<>(domainClass, Id.class);
}