-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added @FieldOrder for bean fields to define their declaration order m…
…anually (since some JVM implementations do not provide them in the right order naturally)
- Loading branch information
Showing
10 changed files
with
162 additions
and
22 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
ojcms-beans/src/main/java/de/adito/ojcms/beans/annotations/FieldOrder.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,25 @@ | ||
package de.adito.ojcms.beans.annotations; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Use this annotation for bean fields to define their declaration order. This is necessary if you are using a JVM implementation that | ||
* does not provide fields in their declaration order naturally (via {@link Class#getDeclaredFields()}. | ||
* <p> | ||
* If this annotation is used at least for one bean field, all other fields must be annotated as well. Otherwise a runtime exception will | ||
* be thrown. The order numbers for a bean class must not contain duplicates, but may have gaps (like 100, 200, 300, ...). | ||
* <p> | ||
* Lower numbers are declared before higher numbers. | ||
* | ||
* @author Simon Danner, 11.06.2020 | ||
*/ | ||
@Documented | ||
@Target(ElementType.FIELD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface FieldOrder | ||
{ | ||
/** | ||
* A number indicating the declaration position of the annotated bean field (lower number = lower position) | ||
*/ | ||
int value(); | ||
} |
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
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
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