Skip to content

Commit

Permalink
Apply formatting rules to the codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Dec 11, 2023
1 parent f14559d commit 0428ccd
Show file tree
Hide file tree
Showing 188 changed files with 1,935 additions and 1,523 deletions.
12 changes: 7 additions & 5 deletions api/src/main/java/jakarta/decorator/Decorator.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 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,
* 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.
Expand All @@ -29,19 +29,21 @@
* <p>
* Specifies that a class is a decorator. May be applied to a managed bean class.
* </p>
*
*
* <pre>
* &#064;Decorator
* &#064;Decorator
* class TimestampLogger implements Logger { ... }
* </pre>
*
*
* <p>
* Decorators of a session bean must comply with the bean provider programming restrictions defined by the EJB specification.
* Decorators of a stateful session bean must comply with the rules for instance passivation and conversational state defined by
* the EJB specification.
* </p>
*
* <p>CDI Lite implementations are not required to provide support for decorators.</p>
* <p>
* CDI Lite implementations are not required to provide support for decorators.
* </p>
*
* @see Delegate &#064;Delegate identifies the delegate injection point of a decorator.
*
Expand Down
48 changes: 25 additions & 23 deletions api/src/main/java/jakarta/decorator/Delegate.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 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,
* 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.
Expand All @@ -29,56 +29,58 @@
* Identifies the delegate injection point of a decorator. May be applied to a field, bean constructor parameter or initializer
* method parameter of a decorator bean class.
* </p>
*
*
* <pre>
* &#064;Decorator
* class TimestampLogger implements Logger {
* &#064;Inject &#064;Delegate &#064;Any Logger logger;
* ...
* &#064;Decorator
* class TimestampLogger implements Logger {
* &#064;Inject &#064;Delegate &#064;Any Logger logger;
* ...
* }
* </pre>
*
*
* <pre>
* &#064;Decorator
* class TimestampLogger implements Logger {
* &#064;Decorator
* class TimestampLogger implements Logger {
* private Logger logger;
*
*
* &#064;Inject
* public TimestampLogger(&#064;Delegate &#064;Debug Logger logger) {
* this.logger=logger;
* }
* ...
* public TimestampLogger(&#064;Delegate &#064;Debug Logger logger) {
* this.logger=logger;
* }
* ...
* }
* </pre>
*
*
* <p>
* A decorator must have exactly one delegate injection point. The delegate injection point must be an injected field,
* initializer method parameter or bean constructor method parameter.
* </p>
*
*
* <p>
* The container injects a delegate object to the delegate injection point. The delegate object implements the delegate type and
* delegates method invocations along the decorator stack. When the container calls a decorator during business method
* interception, the decorator may invoke any method of the delegate object. If a decorator invokes the delegate object at any
* other time, the invoked method throws an {@link java.lang.IllegalStateException}.
* </p>
*
*
* <pre>
* &#064;Decorator
* class TimestampLogger implements Logger {
* &#064;Inject &#064;Delegate &#064;Any Logger logger;
*
* &#064;Decorator
* class TimestampLogger implements Logger {
* &#064;Inject &#064;Delegate &#064;Any Logger logger;
*
* void log(String message) {
* logger.log( timestamp() + ": " + message );
* }
* ...
* }
* </pre>
*
* <p>CDI Lite implementations are not required to provide support for decorators.</p>
* <p>
* CDI Lite implementations are not required to provide support for decorators.
* </p>
*
* @see Decorator &#064;Decorator specifies that a class is a decorator.
*
*
* @author Gavin King
* @author Pete Muir
*/
Expand Down
149 changes: 87 additions & 62 deletions api/src/main/java/jakarta/decorator/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,89 +8,114 @@
* 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,
* 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.
*/
/**
* <p>Annotations relating to decorators.</p>
*
* <p>A decorator implements one or more bean types and
* intercepts business method invocations of
* {@linkplain jakarta.enterprise.inject beans} which
* implement those bean types. These bean types are called
* decorated types.</p>
*
* <p>A decorator is a managed bean annotated {@link
* jakarta.decorator.Decorator &#064;Decorator}.</p>
*
* <p>Decorators are superficially similar to interceptors,
* but because they directly implement operations with business
* semantics, they are able to implement business logic and,
* conversely, unable to implement the cross-cutting concerns
* for which interceptors are optimized. Decorators are called
* after interceptors.</p>
*
* <p>
* Annotations relating to decorators.
* </p>
*
* <p>
* A decorator implements one or more bean types and
* intercepts business method invocations of
* {@linkplain jakarta.enterprise.inject beans} which
* implement those bean types. These bean types are called
* decorated types.
* </p>
*
* <p>
* A decorator is a managed bean annotated {@link
* jakarta.decorator.Decorator &#064;Decorator}.
* </p>
*
* <p>
* Decorators are superficially similar to interceptors,
* but because they directly implement operations with business
* semantics, they are able to implement business logic and,
* conversely, unable to implement the cross-cutting concerns
* for which interceptors are optimized. Decorators are called
* after interceptors.
* </p>
*
* <h2>Decorated types</h2>
*
* <p>The set of decorated types of a decorator includes all
* bean types of the managed bean that are Java interfaces,
* except for {@link java.io.Serializable}. The decorator bean
* class and its superclasses are not decorated types of the
* decorator. The decorator class may be abstract.</p>
*
* <p>A decorator intercepts every method:</p>
*
* <p>
* The set of decorated types of a decorator includes all
* bean types of the managed bean that are Java interfaces,
* except for {@link java.io.Serializable}. The decorator bean
* class and its superclasses are not decorated types of the
* decorator. The decorator class may be abstract.
* </p>
*
* <p>
* A decorator intercepts every method:
* </p>
* <ul>
* <li>declared by a decorated type of the decorator</li>
* <li>that is implemented by the bean class of the decorator.</li>
* </ul>
*
* <p>A decorator may be an abstract class, and is not required to
* implement every method of every decorated type.</p>
*
*
* <p>
* A decorator may be an abstract class, and is not required to
* implement every method of every decorated type.
* </p>
*
* <h2>Delegate injection points</h2>
*
* <p>All decorators have a
* {@linkplain jakarta.decorator.Delegate delegate injection point}.
* A delegate injection point is an injection point of the bean
* class annotated {@link jakarta.decorator.Delegate &#064;Delegate}.</p>
*
* <p>The type of the delegate injection point must implement or
* extend every decorated type. A decorator is not required to
* implement the type of the delegate injection point.</p>
*
*
* <p>
* All decorators have a
* {@linkplain jakarta.decorator.Delegate delegate injection point}.
* A delegate injection point is an injection point of the bean
* class annotated {@link jakarta.decorator.Delegate &#064;Delegate}.
* </p>
*
* <p>
* The type of the delegate injection point must implement or
* extend every decorated type. A decorator is not required to
* implement the type of the delegate injection point.
* </p>
*
* <h2>Enabled decorators</h2>
*
* <p>By default, a bean archive has no enabled decorators. A
* decorator must be explicitly enabled by listing its bean class
*
* <p>
* By default, a bean archive has no enabled decorators. A
* decorator must be explicitly enabled by listing its bean class
* under the <code>&lt;decorators&gt;</code> element of the
* <code>beans.xml</code> file of the bean archive. The order of the
* decorator declarations determines the decorator ordering.
* Decorators which occur earlier in the list are called first.</p>
*
* <p>A decorator is bound to a bean if:</p>
*
* decorator declarations determines the decorator ordering.
* Decorators which occur earlier in the list are called first.
* </p>
*
* <p>
* A decorator is bound to a bean if:
* </p>
*
* <ul>
* <li>The bean is {@linkplain jakarta.enterprise.inject eligible for injection}
* <li>The bean is {@linkplain jakarta.enterprise.inject eligible for injection}
* to the delegate injection point of the decorator.</li>
* <li>The decorator is enabled in the bean archive of the bean.</li>
* </ul>
*
* <p>If a managed bean class is declared final, it may not have
* decorators. If a managed bean has a non-static, non-private,
*
* <p>
* If a managed bean class is declared final, it may not have
* decorators. If a managed bean has a non-static, non-private,
* final method, it may not have any decorator which implements
* that method.</p>
*
* <p>A decorator instance is a
* {@linkplain jakarta.enterprise.context.Dependent dependent object}
* of the object it decorates.</p>
*
* that method.
* </p>
*
* <p>
* A decorator instance is a
* {@linkplain jakarta.enterprise.context.Dependent dependent object}
* of the object it decorates.
* </p>
*
* @see jakarta.enterprise.inject
*
*
* @see jakarta.decorator.Decorator
* @see jakarta.decorator.Delegate
*
*
*/
package jakarta.decorator;

25 changes: 14 additions & 11 deletions api/src/main/java/jakarta/enterprise/context/ApplicationScoped.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@
* <p>
* While <code>ApplicationScoped</code> must be associated with the built-in application context required by the specification,
* third-party extensions are
* allowed to also associate it with their own context. Behavior described below is only related to the built-in application context.
* allowed to also associate it with their own context. Behavior described below is only related to the built-in application
* context.
* </p>
*
* <p>
* The application scope is active:
* </p>
*
* <ul>
* <li>during the <code>service()</code> method of any servlet in the web application, during the <code>doFilter()</code> method of any
* <li>during the <code>service()</code> method of any servlet in the web application, during the <code>doFilter()</code> method
* of any
* servlet filter and when the container calls any <code>ServletContextListener</code>, <code>HttpSessionListener</code>,
* <code>AsyncListener</code> or <code>ServletRequestListener</code>,</li>
* <li>during any Java EE web service invocation,</li>
Expand All @@ -64,15 +66,16 @@
* </p>
*
* <p>
* An event with qualifier <code>@Initialized(ApplicationScoped.class)</code> is fired when the application context is initialized
* and an event with qualifier <code>@Destroyed(ApplicationScoped.class)</code> when the application context is destroyed.
* The event payload is:
* </p>
*
* <ul>
* <li>the <code>ServletContext</code> if the application is a web application deployed to a Servlet container, or</li>
* <li>any <code>java.lang.Object</code> for other types of application.</li>
* </ul>
* An event with qualifier <code>@Initialized(ApplicationScoped.class)</code> is fired when the application context is
* initialized
* and an event with qualifier <code>@Destroyed(ApplicationScoped.class)</code> when the application context is destroyed.
* The event payload is:
* </p>
*
* <ul>
* <li>the <code>ServletContext</code> if the application is a web application deployed to a Servlet container, or</li>
* <li>any <code>java.lang.Object</code> for other types of application.</li>
* </ul>
*
* @author Gavin King
* @author Pete Muir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import jakarta.inject.Qualifier;

/**
* An event with this qualifier is fired when a context is about to be destroyed, i.e. before the actual destruction.
* An event with this qualifier is fired when a context is about to be destroyed, i.e. before the actual destruction.
*
* @author Pete Muir
* @author Martin Kouba
Expand All @@ -47,6 +47,7 @@

/**
* The scope for which to observe destruction
*
* @return the scope type class
*/
Class<? extends Annotation> value();
Expand All @@ -56,14 +57,14 @@
*/
public final static class Literal extends AnnotationLiteral<BeforeDestroyed> implements BeforeDestroyed {

public static final Literal REQUEST = of(RequestScoped.class);
public static final Literal REQUEST = of(RequestScoped.class);

public static final Literal CONVERSATION = of(ConversationScoped.class);

public static final Literal SESSION = of(SessionScoped.class);

public static final Literal APPLICATION = of(ApplicationScoped.class);

private static final long serialVersionUID = 1L;

private final Class<? extends Annotation> value;
Expand Down
Loading

0 comments on commit 0428ccd

Please sign in to comment.