-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApple.java
More file actions
50 lines (39 loc) · 1.16 KB
/
Apple.java
File metadata and controls
50 lines (39 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package annotation;
/**
* 注解使用
*/
public class Apple {
@FruitName
private String appleName;
@FruitColor(fruitColor= FruitColor.Color.RED)
private String appleColor;
@FruitProvider(id=1,name="陕西红富士集团",address="陕西省西安市延安路89号红富士大厦")
private String appleProvider;
public void setAppleColor(String appleColor) {
this.appleColor = appleColor;
}
public String getAppleColor() {
return appleColor;
}
public void setAppleName(String appleName) {
this.appleName = appleName;
}
public String getAppleName() {
return appleName;
}
public void setAppleProvider(String appleProvider) {
this.appleProvider = appleProvider;
}
public String getAppleProvider() {
return appleProvider;
}
public void displayName(){
System.out.println("水果的名字是:苹果");
}
public static void main(String[] args) throws Exception {
Apple apple=new Apple();
System.out.println(apple.getAppleColor());
apple.setAppleName("jjjj");
FruitInfoUtil.getFruitInfo(apple.getClass());
}
}