Skip to content

Commit

Permalink
Make config annotations inherited
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam committed Dec 22, 2023
1 parent 060737e commit 0d06195
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 30 deletions.
2 changes: 1 addition & 1 deletion res/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: RedLib
main: redempt.redlib.RedLib
version: 2022-09-25 01:04
version: 2023-12-22 19:59
author: Redempt
api-version: 1.13
load: STARTUP
7 changes: 2 additions & 5 deletions src/redempt/redlib/config/annotations/Comment.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package redempt.redlib.config.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;

/**
* Used to denote comments which should be applied to a config path. Only supported in 1.18.1+
Expand All @@ -13,6 +9,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Repeatable(Comments.class)
@Inherited
public @interface Comment {

String value();
Expand Down
6 changes: 2 additions & 4 deletions src/redempt/redlib/config/annotations/Comments.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package redempt.redlib.config.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;

/**
* A wrapper for multiple {@link Comment} annotations
* @author Redempt
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Inherited
public @interface Comments {

Comment[] value();
Expand Down
6 changes: 1 addition & 5 deletions src/redempt/redlib/config/annotations/ConfigMappable.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package redempt.redlib.config.annotations;

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;
import java.lang.annotation.*;

/**
* Indicates that a class can be automatically serialized to config
Expand Down
7 changes: 2 additions & 5 deletions src/redempt/redlib/config/annotations/ConfigName.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package redempt.redlib.config.annotations;

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;
import java.lang.annotation.*;

/**
* Specifies the name that should be used to access and set a value in config
Expand All @@ -13,6 +9,7 @@
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface ConfigName {

String value();
Expand Down
7 changes: 2 additions & 5 deletions src/redempt/redlib/config/annotations/ConfigPath.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package redempt.redlib.config.annotations;

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;
import java.lang.annotation.*;

/**
* Indicates that a field should be populated with the last element of the path to its location in config
Expand All @@ -13,5 +9,6 @@
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface ConfigPath {
}
7 changes: 2 additions & 5 deletions src/redempt/redlib/config/annotations/ConfigPostInit.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package redempt.redlib.config.annotations;

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;
import java.lang.annotation.*;

/**
* Indicates that a method should be run when an object is deserialized from config
Expand All @@ -13,5 +9,6 @@
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface ConfigPostInit {
}

0 comments on commit 0d06195

Please sign in to comment.