Skip to content

Commit 43814d2

Browse files
committed
Polishing.
Improve Javadoc.
1 parent f599827 commit 43814d2

File tree

3 files changed

+27
-33
lines changed

3 files changed

+27
-33
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ public void setRepositoryBaseClass(Class<?> repositoryBaseClass) {
118118
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
119119
* repository information.
120120
* <p>
121-
* Default is "false", in order to avoid unnecessary extra interception. This means that no guarantees are provided
122-
* that {@code RepositoryMethodContext} access will work consistently within any method of the advised object.
121+
* Default is {@code false}, in order to avoid unnecessary extra interception. This means that no guarantees are
122+
* provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
123+
* object.
123124
*
124125
* @since 3.4
125126
*/
@@ -130,16 +131,20 @@ public void setExposeMetadata(boolean exposeMetadata) {
130131
/**
131132
* Set the {@link QueryLookupStrategy.Key} to be used.
132133
*
133-
* @param queryLookupStrategyKey
134+
* @param queryLookupStrategyKey the lookup strategy key to be used.
134135
*/
135136
public void setQueryLookupStrategyKey(Key queryLookupStrategyKey) {
136137
this.queryLookupStrategyKey = queryLookupStrategyKey;
137138
}
138139

139140
/**
140-
* Setter to inject a custom repository implementation.
141+
* Setter to provide a single a custom repository implementation. Single custom implementations are considered first
142+
* when determining target method invocations routing. Single custom implementations were superseded by
143+
* {@link RepositoryFragments} that provide a more flexible way to compose repository implementations from multiple
144+
* fragments consisting of a fragment interface and its implementation.
141145
*
142-
* @param customImplementation
146+
* @param customImplementation the single custom implementation.
147+
* @see #setRepositoryFragments(RepositoryFragments)
143148
*/
144149
public void setCustomImplementation(Object customImplementation) {
145150
this.customImplementation = Optional.of(customImplementation);
@@ -148,7 +153,7 @@ public void setCustomImplementation(Object customImplementation) {
148153
/**
149154
* Setter to inject repository fragments.
150155
*
151-
* @param repositoryFragments
156+
* @param repositoryFragments the repository fragments to be used.
152157
*/
153158
public void setRepositoryFragments(RepositoryFragments repositoryFragments) {
154159
this.repositoryFragments = Optional.of(repositoryFragments);
@@ -157,7 +162,7 @@ public void setRepositoryFragments(RepositoryFragments repositoryFragments) {
157162
/**
158163
* Setter to inject a {@link NamedQueries} instance.
159164
*
160-
* @param namedQueries the namedQueries to set
165+
* @param namedQueries the namedQueries to set.
161166
*/
162167
public void setNamedQueries(NamedQueries namedQueries) {
163168
this.namedQueries = namedQueries;
@@ -167,7 +172,7 @@ public void setNamedQueries(NamedQueries namedQueries) {
167172
* Configures the {@link MappingContext} to be used to lookup {@link PersistentEntity} instances for
168173
* {@link #getPersistentEntity()}.
169174
*
170-
* @param mappingContext
175+
* @param mappingContext mapping context to be used.
171176
*/
172177
protected void setMappingContext(MappingContext<?, ?> mappingContext) {
173178
this.mappingContext = Optional.of(mappingContext);

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

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ EvaluationContextProvider getEvaluationContextProvider() {
151151
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
152152
* repository information.
153153
* <p>
154-
* Default is {@literal "false"}, in order to avoid unnecessary extra interception. This means that no guarantees are
154+
* Default is {@literal false}, in order to avoid unnecessary extra interception. This means that no guarantees are
155155
* provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
156156
* object.
157157
* <p>
@@ -325,7 +325,7 @@ public <T> T getRepository(Class<T> repositoryInterface, Object customImplementa
325325
* @return the implemented repository interface.
326326
* @since 2.0
327327
*/
328-
@SuppressWarnings({ "unchecked", "deprecation" })
328+
@SuppressWarnings({ "unchecked", "resource" })
329329
public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fragments) {
330330

331331
if (logger.isDebugEnabled()) {
@@ -493,10 +493,6 @@ protected RepositoryInformation getRepositoryInformation(RepositoryMetadata meta
493493
* fragments hash code. In a typical Spring scenario, that shouldn't impose issues as one repository factory produces
494494
* only a single repository instance for one repository interface. Things might be different when using various
495495
* fragments for the same repository interface.
496-
*
497-
* @param metadata
498-
* @param fragments
499-
* @return
500496
*/
501497
private RepositoryStub getRepositoryStub(RepositoryMetadata metadata, RepositoryFragments fragments) {
502498

@@ -542,19 +538,20 @@ protected ProjectionFactory getProjectionFactory() {
542538
public abstract <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass);
543539

544540
/**
545-
* Create a repository instance as backing for the query proxy.
541+
* Create a instance of the repository base class providing store-specific built-in repository functionality of a
542+
* typical {@code CrudRepository}.
546543
*
547-
* @param metadata
548-
* @return
544+
* @param metadata repository metadata.
545+
* @return object implementing the repository base functionality.
549546
*/
550547
protected abstract Object getTargetRepository(RepositoryInformation metadata);
551548

552549
/**
553550
* Returns the base class backing the actual repository instance. Make sure
554551
* {@link #getTargetRepository(RepositoryInformation)} returns an instance of this class.
555552
*
556-
* @param metadata
557-
* @return
553+
* @param metadata repository metadata.
554+
* @return the repository base class.
558555
*/
559556
protected abstract Class<?> getRepositoryBaseClass(RepositoryMetadata metadata);
560557

@@ -595,9 +592,6 @@ protected Optional<QueryLookupStrategy> getQueryLookupStrategy(@Nullable Key key
595592

596593
/**
597594
* Validates the given repository interface as well as the given custom implementation.
598-
*
599-
* @param repositoryInformation
600-
* @param composition
601595
*/
602596
private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) {
603597

@@ -613,10 +607,6 @@ protected void validate(RepositoryMetadata repositoryMetadata) {
613607
/**
614608
* Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using
615609
* reflection.
616-
*
617-
* @param information
618-
* @param constructorArguments
619-
* @return
620610
*/
621611
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information,
622612
Object... constructorArguments) {
@@ -646,10 +636,6 @@ protected final <R> R getTargetRepositoryViaReflection(Class<?> baseClass, Objec
646636
* <p>
647637
* Note that this method tries to set the constructor accessible if given a non-accessible (that is, non-public)
648638
* constructor, and supports Kotlin classes with optional parameters and default values.
649-
*
650-
* @param baseClass
651-
* @param constructorArguments
652-
* @return
653639
* @since 2.6
654640
*/
655641
@SuppressWarnings("unchecked")
@@ -691,7 +677,7 @@ private Lazy<ProjectionFactory> createProjectionFactory() {
691677
* Checks if at least one {@link RepositoryFragment} indicates need to access to {@link RepositoryMetadata} by being
692678
* flagged with {@link RepositoryMetadataAccess}.
693679
*
694-
* @param fragments
680+
* @param fragments the fragments to intospect.
695681
* @return {@literal true} if access to metadata is required.
696682
*/
697683
private static boolean shouldExposeMetadata(RepositoryFragments fragments) {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@
3131
*/
3232
public interface QueryLookupStrategy {
3333

34-
public static enum Key {
34+
/**
35+
* Enumeration of available query lookup strategies.
36+
*/
37+
enum Key {
3538

3639
CREATE, USE_DECLARED_QUERY, CREATE_IF_NOT_FOUND;
3740

3841
/**
3942
* Returns a strategy key from the given XML value.
4043
*
41-
* @param xml
44+
* @param xml value represented as XML value.
4245
* @return a strategy key from the given XML value
4346
*/
4447
@Nullable

0 commit comments

Comments
 (0)