Java Annotation

求教大神,如何讓Annotation的成員成爲非必填 java

 

@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Table {
	String name();
	String primaryKey();
	
}

@Documented
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {
	String name();
	boolean notNull();
	boolean unique();
	String check();
	public String defaultValue();
	String collate();
}


@Table(name = "", primaryKey = "")
public class Task {
	
	@Column(check = "", collate = "", defaultValue = "", name = "", notNull = false, unique = false)
	private String createTime;
	
	@Column(check = "", collate = "", defaultValue = "", name = "", notNull = false, unique = false)
	private String name;
	
	
}

我不但願Column的全部成員都顯示出來。 code

相關文章
相關標籤/搜索