Skip to content

Commit 162dd83

Browse files
committed
Polishing.
Improve Javadoc. See #3423
1 parent 7cb6301 commit 162dd83

File tree

3 files changed

+30
-36
lines changed

3 files changed

+30
-36
lines changed

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ public void setRepositoryBaseClass(Class<?> repositoryBaseClass) {
122122
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
123123
* repository information.
124124
* <p>
125-
* Default is "false", in order to avoid unnecessary extra interception. This means that no guarantees are provided
126-
* that {@code RepositoryMethodContext} access will work consistently within any method of the advised object.
125+
* Default is {@code false}, in order to avoid unnecessary extra interception. This means that no guarantees are
126+
* provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
127+
* object.
127128
*
128129
* @since 3.4
129130
*/
@@ -134,16 +135,20 @@ public void setExposeMetadata(boolean exposeMetadata) {
134135
/**
135136
* Set the {@link QueryLookupStrategy.Key} to be used.
136137
*
137-
* @param queryLookupStrategyKey
138+
* @param queryLookupStrategyKey the lookup strategy key to be used.
138139
*/
139140
public void setQueryLookupStrategyKey(Key queryLookupStrategyKey) {
140141
this.queryLookupStrategyKey = queryLookupStrategyKey;
141142
}
142143

143144
/**
144-
* Setter to inject a custom repository implementation.
145+
* Setter to provide a single a custom repository implementation. Single custom implementations are considered first
146+
* when determining target method invocations routing. Single custom implementations were superseded by
147+
* {@link RepositoryFragments} that provide a more flexible way to compose repository implementations from multiple
148+
* fragments consisting of a fragment interface and its implementation.
145149
*
146-
* @param customImplementation
150+
* @param customImplementation the single custom implementation.
151+
* @see #setRepositoryFragments(RepositoryFragments)
147152
*/
148153
public void setCustomImplementation(Object customImplementation) {
149154
this.customImplementation = customImplementation;
@@ -153,7 +158,7 @@ public void setCustomImplementation(Object customImplementation) {
153158
* Setter to inject repository fragments. This method is additive and will add another {@link RepositoryFragments} to
154159
* the already existing list of {@link RepositoryFragmentsFunction}.
155160
*
156-
* @param repositoryFragments
161+
* @param repositoryFragments the repository fragments to be used.
157162
*/
158163
public void setRepositoryFragments(RepositoryFragments repositoryFragments) {
159164
setRepositoryFragmentsFunction(RepositoryFragmentsFunction.just(repositoryFragments));
@@ -163,7 +168,7 @@ public void setRepositoryFragments(RepositoryFragments repositoryFragments) {
163168
* Setter to inject repository fragments. This method is additive and will add another {@link RepositoryFragments} to
164169
* the already existing list of {@link RepositoryFragmentsFunction}.
165170
*
166-
* @param fragmentsFunction
171+
* @param fragmentsFunction function to derive additional repository fragments.
167172
* @since 4.0
168173
*/
169174
public void setRepositoryFragmentsFunction(RepositoryFragmentsFunction fragmentsFunction) {
@@ -173,7 +178,7 @@ public void setRepositoryFragmentsFunction(RepositoryFragmentsFunction fragments
173178
/**
174179
* Setter to inject a {@link NamedQueries} instance.
175180
*
176-
* @param namedQueries the namedQueries to set
181+
* @param namedQueries the namedQueries to set.
177182
*/
178183
public void setNamedQueries(NamedQueries namedQueries) {
179184
this.namedQueries = namedQueries;
@@ -183,7 +188,7 @@ public void setNamedQueries(NamedQueries namedQueries) {
183188
* Configures the {@link MappingContext} to be used to lookup {@link PersistentEntity} instances for
184189
* {@link #getPersistentEntity()}.
185190
*
186-
* @param mappingContext
191+
* @param mappingContext mapping context to be used.
187192
*/
188193
protected void setMappingContext(MappingContext<?, ?> mappingContext) {
189194
this.mappingContext = mappingContext;
@@ -301,14 +306,14 @@ public List<QueryMethod> getQueryMethods() {
301306
return repositoryInterface;
302307
}
303308

304-
RepositoryFactorySupport getRequiredFactory() {
309+
private RepositoryFactorySupport getRequiredFactory() {
305310

306311
Assert.state(factory != null, "RepositoryFactory is not initialized");
307312

308313
return factory;
309314
}
310315

311-
RepositoryMetadata getRequiredRepositoryMetadata() {
316+
private RepositoryMetadata getRequiredRepositoryMetadata() {
312317

313318
Assert.state(repositoryMetadata != null, "RepositoryMetadata is not initialized");
314319

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
@@ -144,7 +144,7 @@ public RepositoryFactorySupport() {
144144
* retrieval via the {@code RepositoryMethodContext} class. This is useful if an advised object needs to obtain
145145
* repository information.
146146
* <p>
147-
* Default is {@literal "false"}, in order to avoid unnecessary extra interception. This means that no guarantees are
147+
* Default is {@literal false}, in order to avoid unnecessary extra interception. This means that no guarantees are
148148
* provided that {@code RepositoryMethodContext} access will work consistently within any method of the advised
149149
* object.
150150
* <p>
@@ -304,7 +304,7 @@ public <T> T getRepository(Class<T> repositoryInterface, Object customImplementa
304304
* @return the implemented repository interface.
305305
* @since 2.0
306306
*/
307-
@SuppressWarnings({ "unchecked", "deprecation" })
307+
@SuppressWarnings({ "unchecked", "resource" })
308308
public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fragments) {
309309

310310
if (logger.isDebugEnabled()) {
@@ -484,10 +484,6 @@ protected RepositoryInformation getRepositoryInformation(RepositoryMetadata meta
484484
* fragments hash code. In a typical Spring scenario, that shouldn't impose issues as one repository factory produces
485485
* only a single repository instance for one repository interface. Things might be different when using various
486486
* fragments for the same repository interface.
487-
*
488-
* @param metadata
489-
* @param fragments
490-
* @return
491487
*/
492488
private RepositoryStub getRepositoryStub(RepositoryMetadata metadata, RepositoryFragments fragments) {
493489

@@ -549,19 +545,20 @@ public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClas
549545
}
550546

551547
/**
552-
* Create a repository instance as backing for the query proxy.
548+
* Create a instance of the repository base class providing store-specific built-in repository functionality of a
549+
* typical {@code CrudRepository}.
553550
*
554-
* @param metadata
555-
* @return
551+
* @param metadata repository metadata.
552+
* @return object implementing the repository base functionality.
556553
*/
557554
protected abstract Object getTargetRepository(RepositoryInformation metadata);
558555

559556
/**
560557
* Returns the base class backing the actual repository instance. Make sure
561558
* {@link #getTargetRepository(RepositoryInformation)} returns an instance of this class.
562559
*
563-
* @param metadata
564-
* @return
560+
* @param metadata repository metadata.
561+
* @return the repository base class.
565562
*/
566563
protected abstract Class<?> getRepositoryBaseClass(RepositoryMetadata metadata);
567564

@@ -580,9 +577,6 @@ protected Optional<QueryLookupStrategy> getQueryLookupStrategy(@Nullable Key key
580577

581578
/**
582579
* Validates the given repository interface as well as the given custom implementation.
583-
*
584-
* @param repositoryInformation
585-
* @param composition
586580
*/
587581
private void validate(RepositoryInformation repositoryInformation, RepositoryComposition composition) {
588582

@@ -598,10 +592,6 @@ protected void validate(RepositoryMetadata repositoryMetadata) {
598592
/**
599593
* Creates a repository of the repository base class defined in the given {@link RepositoryInformation} using
600594
* reflection.
601-
*
602-
* @param information
603-
* @param constructorArguments
604-
* @return
605595
*/
606596
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information,
607597
Object... constructorArguments) {
@@ -616,10 +606,6 @@ protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation inf
616606
* <p>
617607
* Note that this method tries to set the constructor accessible if given a non-accessible (that is, non-public)
618608
* constructor, and supports Kotlin classes with optional parameters and default values.
619-
*
620-
* @param baseClass
621-
* @param constructorArguments
622-
* @return
623609
* @since 2.6
624610
*/
625611
@SuppressWarnings("unchecked")
@@ -664,7 +650,7 @@ private Lazy<ProjectionFactory> createProjectionFactory() {
664650
* Checks if at least one {@link RepositoryFragment} indicates need to access to {@link RepositoryMetadata} by being
665651
* flagged with {@link RepositoryMetadataAccess}.
666652
*
667-
* @param fragments
653+
* @param fragments the fragments to intospect.
668654
* @return {@literal true} if access to metadata is required.
669655
*/
670656
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
@@ -32,14 +32,17 @@
3232
*/
3333
public interface QueryLookupStrategy {
3434

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

3740
CREATE, USE_DECLARED_QUERY, CREATE_IF_NOT_FOUND;
3841

3942
/**
4043
* Returns a strategy key from the given XML value.
4144
*
42-
* @param xml
45+
* @param xml value represented as XML value.
4346
* @return a strategy key from the given XML value
4447
*/
4548
public static @Nullable Key create(String xml) {

0 commit comments

Comments
 (0)