-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support for interceptors * fix build * checkstyles * javadoc * handle case where common Builder methods interfere with target bean methods * more checkstyles * Fix for issue #5608 * Fix for issue #5609 * address review comments * resolved the rest of the review comments
- Loading branch information
Showing
30 changed files
with
1,118 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
builder/builder/src/main/java/io/helidon/builder/BuilderInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2022 Oracle and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.helidon.builder; | ||
|
||
/** | ||
* Provides a contract by which the {@link Builder}-annotated builder type can be intercepted (i.e., including decoration or | ||
* mutation). | ||
* <p> | ||
* This type is used when {@link Builder#requireLibraryDependencies} is used. When it is turned off, however, an equivalent | ||
* type will be code-generated into each generated bean. | ||
* Note also that in this situation your interceptor implementation does not need to implement this interface contract, | ||
* but instead must adhere to the following: | ||
* <ul> | ||
* <li>The implementation class type must provide a no-arg accessible constructor available to the generated class, unless | ||
* the {@link io.helidon.builder.Builder#interceptorCreateMethod()} is used. | ||
* <li>The implementation class type must provide a method-compatible (lambda) signature to the {@link #intercept} method. | ||
* <li>Any exceptions that might be thrown from the {@link #intercept} method must be an unchecked exception type. | ||
* </ul> | ||
* | ||
* @param <T> the type of the bean builder to intercept | ||
* | ||
* @see io.helidon.builder.Builder#interceptor() | ||
*/ | ||
@FunctionalInterface | ||
public interface BuilderInterceptor<T> { | ||
|
||
/** | ||
* Provides the ability to intercept (i.e., including decoration or mutation) the target. | ||
* | ||
* @param target the target being intercepted | ||
* @return the mutated or replaced target (must not be null) | ||
*/ | ||
T intercept(T target); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.