-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sisu specific PreConstruct/PreDestroy annotations (#76)
Just like other annotations like Typed, Priority add "own" annotations for Lifecycle as well (while do support JSR250 if present). This closes #58
- Loading branch information
Showing
4 changed files
with
125 additions
and
9 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
org.eclipse.sisu.inject/src/main/java/org/eclipse/sisu/PostConstruct.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,40 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023-present Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* SPDX-License-Identifier: EPL-1.0 | ||
********************************************************************************/ | ||
package org.eclipse.sisu; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* The PostConstruct annotation is used on a method that needs to be executed | ||
* after dependency injection is done to perform any initialization. This | ||
* method is invoked by Sisu before the class is put into service. | ||
* <p> | ||
* This annotation is Sisu specific annotation, that has same semantics as | ||
* {@link javax.annotation.PostConstruct} annotation has, and may be used | ||
* interchangeably. | ||
* <p> | ||
* To use annotation {@link org.eclipse.sisu.bean.LifecycleModule} needs to be | ||
* installed. | ||
* | ||
* @since TBD | ||
*/ | ||
@Target( value = { ElementType.METHOD } ) | ||
@Retention( RetentionPolicy.RUNTIME ) | ||
@Documented | ||
public @interface PostConstruct { | ||
} |
42 changes: 42 additions & 0 deletions
42
org.eclipse.sisu.inject/src/main/java/org/eclipse/sisu/PreDestroy.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,42 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023-present Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* SPDX-License-Identifier: EPL-1.0 | ||
********************************************************************************/ | ||
package org.eclipse.sisu; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* The PreDestroy annotation is used on methods as a callback notification to | ||
* signal that the instance is in the process of being removed by the | ||
* container. The method annotated with PreDestroy is typically used to | ||
* release resources that it has been holding. | ||
* <p> | ||
* This annotation is Sisu specific annotation, that has same semantics as | ||
* {@link javax.annotation.PreDestroy} annotation has, and may be used | ||
* interchangeably. | ||
* <p> | ||
* To use annotation {@link org.eclipse.sisu.bean.LifecycleModule} needs to be | ||
* installed. | ||
* | ||
* @since TBD | ||
*/ | ||
|
||
@Target( value = { ElementType.METHOD } ) | ||
@Retention( RetentionPolicy.RUNTIME ) | ||
@Documented | ||
public @interface PreDestroy { | ||
} |
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