Bu yazimizda Java Class`larimi kullanarak nasil XSD, file`lari yaratigimizi gorecegiz..
Oncelikle, birbiri ile iliskili 2 tane java class, olusturalim.. Student ve Exam adinda
import java.util.List;
/**
*
* @author ErtugrulA
*/
public class Student {
private Long id;
private String fullName;
private List exams;
public List getExams() {
return exams;
}
public void setExams(List exams) {
this.exams = exams;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
/**
*
* @author ErtugrulA
*/
public class Student {
private Long id;
private String fullName;
private List
public List
return exams;
}
public void setExams(List
this.exams = exams;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
import java.util.Date;
/**
*
* @author ErtugrulA
*/
public class Exam {
private String name;
private Date examDate;
private String examScore;
public Date getExamDate() {
return examDate;
}
public void setExamDate(Date examDate) {
this.examDate = examDate;
}
public String getExamScore() {
return examScore;
}
public void setExamScore(String examScore) {
this.examScore = examScore;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
/**
*
* @author ErtugrulA
*/
public class Exam {
private String name;
private Date examDate;
private String examScore;
public Date getExamDate() {
return examDate;
}
public void setExamDate(Date examDate) {
this.examDate = examDate;
}
public String getExamScore() {
return examScore;
}
public void setExamScore(String examScore) {
this.examScore = examScore;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Simdi bu class`larimi kullanarak, xsd file`mizi olusturalim..
Bunun icin ilk once classpath ayarlarini yapmamiz gerekmektedir...
Ben class path`de asagidaki lokasyonlari gosterdim.. Burada dikkat edilmesi gereken, bize tools.jar file`ini bende, c:\program files\java\lib\tools.jar icerisinde ariyordu, bende bu folderi kopyalayip buraya attmisdim,
C:\Program Files\Java\jdk1.6.0_13\bin;C:\Program Files\sges-v3\glassfish\bin;
bundan sonra asagidaki yollari izleyecegiz...
Yukaridaki islemlerden sonra, bizim gosterdigimiz yoldaki generated klosorunun, icine class`larimizin yapisina uygun olarak schema1.xsd olusturuldu....
Hiç yorum yok:
Yorum Gönder