-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bc3124
commit d23bf79
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
study-annotations/src/com/example/lottery/application/LotteryApplication.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,13 @@ | ||
package com.example.lottery.application; | ||
|
||
import com.example.lottery.model.LotteryViewModel; | ||
|
||
public class LotteryApplication { | ||
|
||
public static void main(String[] args) { | ||
LotteryViewModel model = new LotteryViewModel(); | ||
System.out.println(model.getNumbers()); | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
study-annotations/src/com/example/lottery/model/LotteryViewModel.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 com.example.lottery.model; | ||
|
||
import java.util.List; | ||
|
||
public class LotteryViewModel { | ||
// metadata | ||
// @RandomNumber(min=1,max=60,size=6,sorted=true,unique=true) | ||
@RandomNumber | ||
private List<Integer> numbers; | ||
|
||
public LotteryViewModel() { | ||
} | ||
|
||
public List<Integer> getNumbers() { | ||
return numbers; | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
study-annotations/src/com/example/lottery/model/RandomNumber.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 com.example.lottery.model; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.FIELD,ElementType.PARAMETER}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Inherited | ||
public @interface RandomNumber { | ||
int min() default 1; | ||
|
||
int max() default 60 ; | ||
|
||
int size() default 6; | ||
|
||
boolean unique() default true; | ||
|
||
boolean sorted() default true; | ||
|
||
} |