package util.sql;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface SqlField {
public KeyType type( ) default KeyType.NOT_KEY;
enum KeyType {
NOT_KEY,
PRIMARY_KEY,
AUTO_INCREMENT_KEY
}
}
之后比如在某个对象类中用到起什么作用
public class Student{
@SqlField( type=KeyType.AUTO_INCREMENT_KEY)
public int id;
@SqlField
public float score;
@SqlField
public int sex;
@SqlField
public String num;
。。。。。}