introduction to xbase
TRANSCRIPT
public class Customer implements Serializable {
private String name;private Address address;private List<Phone> phones;
public String getName() {return name;
}public void setName(String name) {
this.name = name;}
public Address getAddress() {return address;
}public void setAddress(Address address) {
this.address = address;}
public List<Phone> getPhones() {return phones;
}public void setPhones(List<Phone> phones) {
this.phones = phones;}
}
bean Customer { name: String address: Address phones: Phone* }
@Entity public class Customer implements Serializable {
@Idprivate String name;private Address address;private List<Phone> phones;
public String getName() {return name;
}public void setName(String name) {
this.name = name;}@Column(name="ADDR", nullable=false)public Address getAddress() {
return address;}public void setAddress(Address address) {
this.address = address;}@OneToManypublic List<Phone> getPhones() {
return phones;}public void setPhones(List<Phone> phones) {
this.phones = phones;}
}
bean Customer { name: String address: Address phones: Phone* }
Grammargrammar org.xtext.example.BeanDsl with org.eclipse.xtext.xbase.Xbase
generate beanDsl "http://www.xtext.org/example/BeanDsl"
Root:beans+=Bean*;
Bean:'bean' name=ID '{'
property+=Property*'}'
;
Property:name=ID ':' (simpleType=TYPE | reference=[Bean]) list?='*'?
;
enum TYPE:String | Int
;
Create a new ParserRuleWeave it into the Expression TreeConvince AntlrCompute the type for itImplement a compiler
Ingredients
Create a new ParserRuleWeave it into the Expression TreeConvince AntlrCompute the type for itImplement a compiler
Ingredients
Just kidding :-)