@AuthorAnnotation(name="Tom",company="ABC Company")
public class Person{  
  @CommonAnnotation(type=String.class,description="姓名")
  private String name;

  @CommonAnnotation(type=int.class,description="年龄")
  private int age;
  
  @ConstructorAnnotation
  public Person(){
    this("unknown",0);
  }
 
  @ConstructorAnnotation("带参数的构造方法")
  public Person(
    //注解构造方法的参数
    @CommonAnnotation(type=String.class,description="姓名")String name,
    @CommonAnnotation(type=int.class,description="年龄")int age){
    this.name=name;
    this.age=age;
  }

  @CommonAnnotation(type=String.class,description="获得姓名")
  public String getName(){
    return name;
  }  

  @CommonAnnotation(type=int.class,description="获得年龄")
  public int getAge(){
    return age;
  }

  @CommonAnnotation(description="设置姓名")
  public void setName( 
    @CommonAnnotation(type=String.class,description="姓名")String name){
    this.name=name;
  }

  @CommonAnnotation(description="设置年龄")
  public void setAge(
    @CommonAnnotation(type=int.class,description="年龄")int age){
    this.age=age; 
  }
}


/****************************************************
 * 作者：孙卫琴                                     *
 * 来源：<<Java面向对象编程>>                       *
 * 技术支持网址：www.javathinker.net                *
 ***************************************************/
