Tabnine Logo
RepositoryFactorySupport
Code IndexAdd Tabnine to your IDE (free)

How to use
RepositoryFactorySupport
in
org.springframework.data.repository.core.support

Best Java code snippets using org.springframework.data.repository.core.support.RepositoryFactorySupport (Showing top 20 results out of 315)

origin: apache/ignite

/** {@inheritDoc} */
@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) {
  Assert.notNull(repoItf, "Repository interface must be set.");
  Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface.");
  RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class);
  Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " +
    "this repository to the underlying cache.");
  Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " +
    "annotation to map this repository to the underlying cache.");
  repoToCache.put(repoItf, annotation.cacheName());
  return super.getRepositoryMetadata(repoItf);
}
origin: spring-projects/spring-data-jpa

@Override
public void setBeanClassLoader(ClassLoader classLoader) {
  super.setBeanClassLoader(classLoader);
  this.crudMethodMetadataPostProcessor.setBeanClassLoader(classLoader);
}
origin: apache/servicemix-bundles

public void afterPropertiesSet() {
  this.factory = createRepositoryFactory();
  this.factory.setQueryLookupStrategyKey(queryLookupStrategyKey);
  this.factory.setNamedQueries(namedQueries);
  this.factory.setEvaluationContextProvider(
      evaluationContextProvider.orElseGet(() -> QueryMethodEvaluationContextProvider.DEFAULT));
  this.factory.setBeanClassLoader(classLoader);
  this.factory.setBeanFactory(beanFactory);
  if (publisher != null) {
    this.factory.addRepositoryProxyPostProcessor(new EventPublishingRepositoryProxyPostProcessor(publisher));
  }
  repositoryBaseClass.ifPresent(this.factory::setRepositoryBaseClass);
  RepositoryFragments customImplementationFragment = customImplementation //
      .map(RepositoryFragments::just) //
      .orElseGet(RepositoryFragments::empty);
  RepositoryFragments repositoryFragmentsToUse = this.repositoryFragments //
      .orElseGet(RepositoryFragments::empty) //
      .append(customImplementationFragment);
  this.repositoryMetadata = this.factory.getRepositoryMetadata(repositoryInterface);
  // Make sure the aggregate root type is present in the MappingContext (e.g. for auditing)
  this.mappingContext.ifPresent(it -> it.getPersistentEntity(repositoryMetadata.getDomainType()));
  this.repository = Lazy.of(() -> this.factory.getRepository(repositoryInterface, repositoryFragmentsToUse));
  if (!lazyInit) {
    this.repository.get();
  }
}
origin: com.blazebit/blaze-persistence-integration-spring-data

public void afterPropertiesSet() {
  this.factory = createRepositoryFactory();
  this.factory.setQueryLookupStrategyKey(queryLookupStrategyKey);
  this.factory.setNamedQueries(namedQueries);
  this.factory.setEvaluationContextProvider(evaluationContextProvider);
  this.factory.setRepositoryBaseClass(repositoryBaseClass);
  this.factory.setBeanClassLoader(classLoader);
  this.factory.setBeanFactory(beanFactory);
  if (publisher != null) {
    RepositoryProxyPostProcessor repositoryProxyPostProcessor = null;
    try {
      repositoryProxyPostProcessor = (RepositoryProxyPostProcessor) Class.forName("org.springframework.data.repository.core.support.EventPublishingRepositoryProxyPostProcessor").getConstructor(ApplicationEventPublisher.class).newInstance(publisher);
    } catch (Exception e) {
      // ignore
    }
    if (repositoryProxyPostProcessor != null) {
      this.factory.addRepositoryProxyPostProcessor(repositoryProxyPostProcessor);
    }
  }
  this.repositoryMetadata = this.factory.getRepositoryMetadata(repositoryInterface);
  if (!lazyInit) {
    initAndReturn();
  }
}
origin: apache/servicemix-bundles

Assert.notNull(fragments, "RepositoryFragments must not be null!");
RepositoryMetadata metadata = getRepositoryMetadata(repositoryInterface);
RepositoryComposition composition = getRepositoryComposition(metadata, fragments);
RepositoryInformation information = getRepositoryInformation(metadata, composition);
validate(information, composition);
Object target = getTargetRepository(information);
ProjectionFactory projectionFactory = getProjectionFactory(classLoader, beanFactory);
result.addAdvice(new QueryExecutorMethodInterceptor(information, projectionFactory));
origin: org.springframework.data/spring-data-commons-core

/**
 * Returns a repository instance for the given interface backed by an instance providing implementation logic for
 * custom logic.
 * 
 * @param <T>
 * @param repositoryInterface
 * @param customImplementation
 * @return
 */
@SuppressWarnings({ "unchecked" })
public <T> T getRepository(Class<T> repositoryInterface, Object customImplementation) {
  RepositoryMetadata metadata = getRepositoryMetadata(repositoryInterface);
  Class<?> customImplementationClass = null == customImplementation ? null : customImplementation.getClass();
  RepositoryInformation information = getRepositoryInformation(metadata, customImplementationClass);
  validate(information, customImplementation);
  Object target = getTargetRepository(information);
  // Create proxy
  ProxyFactory result = new ProxyFactory();
  result.setTarget(target);
  result.setInterfaces(new Class[] { repositoryInterface, Repository.class });
  for (RepositoryProxyPostProcessor processor : postProcessors) {
    processor.postProcess(result);
  }
  result.addAdvice(new QueryExecutorMethodInterceptor(information, customImplementation, target));
  return (T) result.getProxy();
}
origin: org.springframework.data/spring-data-commons-core

/**
 * Returns a repository instance for the given interface.
 * 
 * @param <T>
 * @param repositoryInterface
 * @return
 */
public <T> T getRepository(Class<T> repositoryInterface) {
  return getRepository(repositoryInterface, null);
}
origin: org.springframework.data/spring-data-commons-core

public RepositoryInformation getRepositoryInformation() {
  RepositoryMetadata metadata = factory.getRepositoryMetadata(repositoryInterface);
  return this.factory.getRepositoryInformation(metadata,
      customImplementation == null ? null : customImplementation.getClass());
}
origin: org.springframework.data/spring-data-commons-core

@SuppressWarnings("unchecked")
public EntityInformation<S, ID> getEntityInformation() {
  RepositoryMetadata repositoryMetadata = factory.getRepositoryMetadata(repositoryInterface);
  return (EntityInformation<S, ID>) factory.getEntityInformation(repositoryMetadata.getDomainType());
}
origin: apache/servicemix-bundles

/**
 * Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using
 * reflection.
 *
 * @param information
 * @param constructorArguments
 * @return
 */
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information,
    Object... constructorArguments) {
  Class<?> baseClass = information.getRepositoryBaseClass();
  return getTargetRepositoryViaReflection(baseClass, constructorArguments);
}
origin: org.springframework.data/spring-data-commons-core

public void afterPropertiesSet() {
  this.factory = createRepositoryFactory();
  this.factory.setQueryLookupStrategyKey(queryLookupStrategyKey);
  this.factory.setNamedQueries(namedQueries);
}
origin: apache/servicemix-bundles

/**
 * Returns the {@link RepositoryInformation} for the given {@link RepositoryMetadata} and custom
 * {@link RepositoryFragments}.
 *
 * @param metadata must not be {@literal null}.
 * @param fragments must not be {@literal null}.
 * @return will never be {@literal null}.
 */
protected RepositoryInformation getRepositoryInformation(RepositoryMetadata metadata, RepositoryFragments fragments) {
  return getRepositoryInformation(metadata, getRepositoryComposition(metadata, fragments));
}
origin: com.blazebit/blaze-persistence-integration-spring-data

/**
 * Delegates {@link RepositoryFactorySupport} creation to {@link #doCreateRepositoryFactory()} and applies the
 * {@link TransactionalRepositoryProxyPostProcessor} to the created instance.
 *
 * @see BlazeRepositoryFactoryBeanSupport #createRepositoryFactory()
 */
@Override
protected final RepositoryFactorySupport createRepositoryFactory() {
  RepositoryFactorySupport factory = doCreateRepositoryFactory();
  factory.addRepositoryProxyPostProcessor(exceptionPostProcessor);
  factory.addRepositoryProxyPostProcessor(txPostProcessor);
  return factory;
}
origin: com.blazebit/blaze-persistence-integration-spring-data

public List<QueryMethod> getQueryMethods() {
  return factory.getQueryMethods();
}
origin: com.blazebit/blaze-persistence-integration-spring-data

@SuppressWarnings("unchecked")
public EntityInformation<S, ID> getEntityInformation() {
  return (EntityInformation<S, ID>) factory.getEntityInformation(repositoryMetadata.getDomainType());
}
origin: com.blazebit/blaze-persistence-integration-spring-data

public RepositoryInformation getRepositoryInformation() {
  return this.factory.getRepositoryInformation(repositoryMetadata,
      customImplementation == null ? null : customImplementation.getClass());
}
origin: apache/servicemix-bundles

/**
 * Creates the actual repository instance.
 *
 * @param repositoryType will never be {@literal null}.
 * @param repositoryFragments will never be {@literal null}.
 * @return
 */
protected static <T> T create(RepositoryFactorySupport repositoryFactory, Class<T> repositoryType,
    RepositoryFragments repositoryFragments) {
  return repositoryFactory.getRepository(repositoryType, repositoryFragments);
}
origin: spring-projects/spring-data-keyvalue

@Override
protected Object getTargetRepository(RepositoryInformation repositoryInformation) {
  EntityInformation<?, ?> entityInformation = getEntityInformation(repositoryInformation.getDomainType());
  return super.getTargetRepositoryViaReflection(repositoryInformation, entityInformation, keyValueOperations);
}
origin: apache/servicemix-bundles

/**
 * Delegates {@link RepositoryFactorySupport} creation to {@link #doCreateRepositoryFactory()} and applies the
 * {@link TransactionalRepositoryProxyPostProcessor} to the created instance.
 *
 * @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport #createRepositoryFactory()
 */
@Override
protected final RepositoryFactorySupport createRepositoryFactory() {
  RepositoryFactorySupport factory = doCreateRepositoryFactory();
  RepositoryProxyPostProcessor exceptionPostProcessor = this.exceptionPostProcessor;
  if (exceptionPostProcessor != null) {
    factory.addRepositoryProxyPostProcessor(exceptionPostProcessor);
  }
  RepositoryProxyPostProcessor txPostProcessor = this.txPostProcessor;
  if (txPostProcessor != null) {
    factory.addRepositoryProxyPostProcessor(txPostProcessor);
  }
  return factory;
}
origin: org.springframework.data/spring-data-commons-core

public List<QueryMethod> getQueryMethods() {
  return factory.getQueryMethods();
}
org.springframework.data.repository.core.supportRepositoryFactorySupport

Javadoc

Factory bean to create instances of a given repository interface. Creates a proxy implementing the configured repository interface and apply an advice handing the control to the QueryExecuterMethodInterceptor. Query detection strategy can be configured by setting QueryLookupStrategy.Key.

Most used methods

  • getRepositoryMetadata
    Returns the RepositoryMetadata for the given repository interface.
  • setBeanClassLoader
  • getRepository
    Returns a repository instance for the given interface backed by an instance providing implementation
  • getTargetRepositoryViaReflection
  • addRepositoryProxyPostProcessor
    Adds RepositoryProxyPostProcessors to the factory to allow manipulation of the ProxyFactory before t
  • getEntityInformation
    Returns the EntityInformation for the given domain class.
  • getQueryMethods
  • getRepositoryInformation
    Returns the RepositoryInformation for the given repository interface.
  • setNamedQueries
    Configures a NamedQueries instance to be handed to the QueryLookupStrategy for query creation.
  • setQueryLookupStrategyKey
    Sets the strategy of how to lookup a query to execute finders.
  • getQueryLookupStrategy
    Returns the QueryLookupStrategy for the given Key.
  • getRepositoryBaseClass
    Returns the base class backing the actual repository instance. Make sure #getTargetRepository(Reposi
  • getQueryLookupStrategy,
  • getRepositoryBaseClass,
  • getTargetRepository,
  • setBeanFactory,
  • setEvaluationContextProvider,
  • setRepositoryBaseClass,
  • validate,
  • addQueryCreationListener,
  • getProjectionFactory,
  • getRepositoryComposition

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JComboBox (javax.swing)
  • JFrame (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now