Browse Source

Polishing.

Improve Javadoc.
3.5.x
Mark Paluch 2 weeks ago
parent
commit
43814d2ef0
No known key found for this signature in database
GPG Key ID: 55BC6374BAA9D973
  1. 21
      src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java
  2. 32
      src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java
  3. 7
      src/main/java/org/springframework/data/repository/query/QueryLookupStrategy.java

21
src/main/java/org/springframework/data/repository/core/support/RepositoryFactoryBeanSupport.java

@ -118,8 +118,9 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain * retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
* repository information. * repository information.
* <p> * <p>
* Default is "false", in order to avoid unnecessary extra interception. This means that no guarantees are provided * Default is {@code false}, in order to avoid unnecessary extra interception. This means that no guarantees are
* that {@code RepositoryMethodContext} access will work consistently within any method of the advised object. * provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
* object.
* *
* @since 3.4 * @since 3.4
*/ */
@ -130,16 +131,20 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
/** /**
* Set the {@link QueryLookupStrategy.Key} to be used. * Set the {@link QueryLookupStrategy.Key} to be used.
* *
* @param queryLookupStrategyKey * @param queryLookupStrategyKey the lookup strategy key to be used.
*/ */
public void setQueryLookupStrategyKey(Key queryLookupStrategyKey) { public void setQueryLookupStrategyKey(Key queryLookupStrategyKey) {
this.queryLookupStrategyKey = queryLookupStrategyKey; this.queryLookupStrategyKey = queryLookupStrategyKey;
} }
/** /**
* Setter to inject a custom repository implementation. * Setter to provide a single a custom repository implementation. Single custom implementations are considered first
* when determining target method invocations routing. Single custom implementations were superseded by
* {@link RepositoryFragments} that provide a more flexible way to compose repository implementations from multiple
* fragments consisting of a fragment interface and its implementation.
* *
* @param customImplementation * @param customImplementation the single custom implementation.
* @see #setRepositoryFragments(RepositoryFragments)
*/ */
public void setCustomImplementation(Object customImplementation) { public void setCustomImplementation(Object customImplementation) {
this.customImplementation = Optional.of(customImplementation); this.customImplementation = Optional.of(customImplementation);
@ -148,7 +153,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
/** /**
* Setter to inject repository fragments. * Setter to inject repository fragments.
* *
* @param repositoryFragments * @param repositoryFragments the repository fragments to be used.
*/ */
public void setRepositoryFragments(RepositoryFragments repositoryFragments) { public void setRepositoryFragments(RepositoryFragments repositoryFragments) {
this.repositoryFragments = Optional.of(repositoryFragments); this.repositoryFragments = Optional.of(repositoryFragments);
@ -157,7 +162,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
/** /**
* Setter to inject a {@link NamedQueries} instance. * Setter to inject a {@link NamedQueries} instance.
* *
* @param namedQueries the namedQueries to set * @param namedQueries the namedQueries to set.
*/ */
public void setNamedQueries(NamedQueries namedQueries) { public void setNamedQueries(NamedQueries namedQueries) {
this.namedQueries = namedQueries; this.namedQueries = namedQueries;
@ -167,7 +172,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
* Configures the {@link MappingContext} to be used to lookup {@link PersistentEntity} instances for * Configures the {@link MappingContext} to be used to lookup {@link PersistentEntity} instances for
* {@link #getPersistentEntity()}. * {@link #getPersistentEntity()}.
* *
* @param mappingContext * @param mappingContext mapping context to be used.
*/ */
protected void setMappingContext(MappingContext<?, ?> mappingContext) { protected void setMappingContext(MappingContext<?, ?> mappingContext) {
this.mappingContext = Optional.of(mappingContext); this.mappingContext = Optional.of(mappingContext);

32
src/main/java/org/springframework/data/repository/core/support/RepositoryFactorySupport.java

@ -151,7 +151,7 @@ public abstract class RepositoryFactorySupport
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain * retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
* repository information. * repository information.
* <p> * <p>
* Default is {@literal "false"}, in order to avoid unnecessary extra interception. This means that no guarantees are * Default is {@literal false}, in order to avoid unnecessary extra interception. This means that no guarantees are
* provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised * provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
* object. * object.
* <p> * <p>
@ -325,7 +325,7 @@ public abstract class RepositoryFactorySupport
* @return the implemented repository interface. * @return the implemented repository interface.
* @since 2.0 * @since 2.0
*/ */
@SuppressWarnings({ "unchecked", "deprecation" }) @SuppressWarnings({ "unchecked", "resource" })
public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fragments) { public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fragments) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
@ -493,10 +493,6 @@ public abstract class RepositoryFactorySupport
* fragments hash code. In a typical Spring scenario, that shouldn't impose issues as one repository factory produces * fragments hash code. In a typical Spring scenario, that shouldn't impose issues as one repository factory produces
* only a single repository instance for one repository interface. Things might be different when using various * only a single repository instance for one repository interface. Things might be different when using various
* fragments for the same repository interface. * fragments for the same repository interface.
*
* @param metadata
* @param fragments
* @return
*/ */
private RepositoryStub getRepositoryStub(RepositoryMetadata metadata, RepositoryFragments fragments) { private RepositoryStub getRepositoryStub(RepositoryMetadata metadata, RepositoryFragments fragments) {
@ -542,10 +538,11 @@ public abstract class RepositoryFactorySupport
public abstract <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass); public abstract <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass);
/** /**
* Create a repository instance as backing for the query proxy. * Create a instance of the repository base class providing store-specific built-in repository functionality of a
* typical {@code CrudRepository}.
* *
* @param metadata * @param metadata repository metadata.
* @return * @return object implementing the repository base functionality.
*/ */
protected abstract Object getTargetRepository(RepositoryInformation metadata); protected abstract Object getTargetRepository(RepositoryInformation metadata);
@ -553,8 +550,8 @@ public abstract class RepositoryFactorySupport
* Returns the base class backing the actual repository instance. Make sure * Returns the base class backing the actual repository instance. Make sure
* {@link #getTargetRepository(RepositoryInformation)} returns an instance of this class. * {@link #getTargetRepository(RepositoryInformation)} returns an instance of this class.
* *
* @param metadata * @param metadata repository metadata.
* @return * @return the repository base class.
*/ */
protected abstract Class<?> getRepositoryBaseClass(RepositoryMetadata metadata); protected abstract Class<?> getRepositoryBaseClass(RepositoryMetadata metadata);
@ -595,9 +592,6 @@ public abstract class RepositoryFactorySupport
/** /**
* Validates the given repository interface as well as the given custom implementation. * Validates the given repository interface as well as the given custom implementation.
*
* @param repositoryInformation
* @param composition
*/ */
private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) { private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) {
@ -613,10 +607,6 @@ public abstract class RepositoryFactorySupport
/** /**
* Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using * Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using
* reflection. * reflection.
*
* @param information
* @param constructorArguments
* @return
*/ */
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information, protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information,
Object... constructorArguments) { Object... constructorArguments) {
@ -646,10 +636,6 @@ public abstract class RepositoryFactorySupport
* <p> * <p>
* Note that this method tries to set the constructor accessible if given a non-accessible (that is, non-public) * Note that this method tries to set the constructor accessible if given a non-accessible (that is, non-public)
* constructor, and supports Kotlin classes with optional parameters and default values. * constructor, and supports Kotlin classes with optional parameters and default values.
*
* @param baseClass
* @param constructorArguments
* @return
* @since 2.6 * @since 2.6
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -691,7 +677,7 @@ public abstract class RepositoryFactorySupport
* Checks if at least one {@link RepositoryFragment} indicates need to access to {@link RepositoryMetadata} by being * Checks if at least one {@link RepositoryFragment} indicates need to access to {@link RepositoryMetadata} by being
* flagged with {@link RepositoryMetadataAccess}. * flagged with {@link RepositoryMetadataAccess}.
* *
* @param fragments * @param fragments the fragments to intospect.
* @return {@literal true} if access to metadata is required. * @return {@literal true} if access to metadata is required.
*/ */
private static boolean shouldExposeMetadata(RepositoryFragments fragments) { private static boolean shouldExposeMetadata(RepositoryFragments fragments) {

7
src/main/java/org/springframework/data/repository/query/QueryLookupStrategy.java

@ -31,14 +31,17 @@ import org.springframework.util.StringUtils;
*/ */
public interface QueryLookupStrategy { public interface QueryLookupStrategy {
public static enum Key { /**
* Enumeration of available query lookup strategies.
*/
enum Key {
CREATE, USE_DECLARED_QUERY, CREATE_IF_NOT_FOUND; CREATE, USE_DECLARED_QUERY, CREATE_IF_NOT_FOUND;
/** /**
* Returns a strategy key from the given XML value. * Returns a strategy key from the given XML value.
* *
* @param xml * @param xml value represented as XML value.
* @return a strategy key from the given XML value * @return a strategy key from the given XML value
*/ */
@Nullable @Nullable

Loading…
Cancel
Save