Why there is an additional ".smap" file when code are automatically generated? [message #1032255] |
Tue, 02 April 2013 19:28 |
Hao Zhang Messages: 107 Registered: April 2013 |
Senior Member |
|
|
I am following the "domain-model" tutorial.I create the ".dmodel" file in the run-time eclipse, after I save the ".dmodel" file, some files are automatically generated in the src_gen directory. But why there is an additional file ".smap" file in the same file directory? Is everything normal, or there are some mistakes in my projects?
The content of the ".dmodel" file is as follows:
import java.util.List
package my.model {
entity Person {
name: String
firstName: String
friends: List<Person>
address : Address
op getFullName() : String {
var age = 15;
if (age > 12)
{
age =10;
}
return firstName + " " + name;
}
op getFriendsSortedByFullName() : List<Person> {
return friends.sortBy[ f | f.fullName ]
}
}
entity Address {
street: String
zip: String
city: String
}
}
The automatically generated "Person.java" file is as follows:
package my.model;
import java.util.List;
import my.model.Address;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.util.ToStringHelper;
public class Person {
public Person() {
}
public Person(final Procedure1<Person> initializer) {
initializer.apply(this);
}
private String name;
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
private String firstName;
public String getFirstName() {
return this.firstName;
}
public void setFirstName(final String firstName) {
this.firstName = firstName;
}
private List<Person> friends;
public List<Person> getFriends() {
return this.friends;
}
public void setFriends(final List<Person> friends) {
this.friends = friends;
}
private Address address;
public Address getAddress() {
return this.address;
}
public void setAddress(final Address address) {
this.address = address;
}
public String getFullName() {
int age = 15;
boolean _greaterThan = (age > 12);
if (_greaterThan) {
age = 10;
}
String _plus = (this.firstName + " ");
return (_plus + this.name);
}
public List<Person> getFriendsSortedByFullName() {
final Function1<Person,String> _function = new Function1<Person,String>() {
public String apply(final Person f) {
String _fullName = f.getFullName();
return _fullName;
}
};
return IterableExtensions.<Person, String>sortBy(this.friends, _function);
}
@Override
public String toString() {
String result = new ToStringHelper().toString(this);
return result;
}
}
The additonal "Person.smap" file as as follows:
SMAP
Person.java
Domainmodel
*S Domainmodel
*F
+ 0 NewTryFile.dmodel
src/NewTryFile.dmodel
*L
11:60
12:61,2
14:63
12:64
17:65,2
21:71,7
*E
Thank you in advance!
|
|
|
Powered by
FUDForum. Page generated in 0.04207 seconds