-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add annotization based config declaring
- Loading branch information
Nathan Martin
committed
Sep 5, 2024
1 parent
3d216b9
commit 101f19c
Showing
31 changed files
with
492 additions
and
141 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
12 changes: 12 additions & 0 deletions
12
core/src/main/java/group/aelysium/rustyconnector/common/Closure.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,12 @@ | ||
package group.aelysium.rustyconnector.common; | ||
|
||
/** | ||
* Enforces a closure on the inheriting entity. | ||
*/ | ||
public interface Closure { | ||
/** | ||
* Closes the inheriting entity releasing all of its resources. | ||
* @throws Exception If there's an issue during the closure. | ||
*/ | ||
void close() throws Exception; | ||
} |
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
26 changes: 26 additions & 0 deletions
26
core/src/main/java/group/aelysium/rustyconnector/common/config/Comment.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,26 @@ | ||
package group.aelysium.rustyconnector.common.config; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.FIELD) | ||
/** | ||
* Allows you to programmatically add YAML comments to your {@link Config}. | ||
*/ | ||
public @interface Comment { | ||
/** | ||
* The order of this entry. | ||
* This value manages how the elements will appear in the config. | ||
*/ | ||
int order() default 0; | ||
|
||
/** | ||
* The comment to show. | ||
* Each new array element will be put on a newline. | ||
* If a entry is provided without a leading # character, one will be added. | ||
*/ | ||
String[] value(); | ||
} |
18 changes: 18 additions & 0 deletions
18
core/src/main/java/group/aelysium/rustyconnector/common/config/Config.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,18 @@ | ||
package group.aelysium.rustyconnector.common.config; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface Config { | ||
/** | ||
* The location of the config. | ||
* Points to the config's physical path on the machine. | ||
* If the config exists, it'll load the details. | ||
* If it doesn't exist, it'll be created. | ||
*/ | ||
String value(); | ||
} |
Oops, something went wrong.