본문 바로가기

JAVA/쓸만한 코드

DTO 기본형

package dto;

//Data Transfer Object 의 기본형
//=Value Object
public class Human {

	private int number;//선수번호 = 주민번호->중복 없음 = sequence number
	private String name;
	private int age;
	private double height;
	
	public Human() {
		// TODO Auto-generated constructor stub
	}

	//Human 오버로드
	public Human(int number, String name, int age, double height) {
		super();
		this.number = number;
		this.name = name;
		this.age = age;
		this.height = height;
	}

	//setter getter 생성
	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

	@Override
	public String toString() {
		return "Human [number=" + number + ", name=" + name + ", age=" + age + ", height=" + height + "]";
	}
	
	
}