# Processed Annotations

Xtend comes with annotations that help to steer the compilation process. These annotations reside in the org.eclipse.xtend.lib plug-in/jar which must be on the classpath of the project containing the Xtend files.

## @Property

For fields that are annotated as @Property, the Xtend compiler will generate a Java field, a getter and, if the field is non-final, a setter method. The name of the Java field will be prefixed with an _ and have the visibility of the Xtend field. The accessors methods are always public. Thus, an Xtend field

@Property String name

will compile to the Java code

private String _name;
public String getName() {
return this._name;
}
public void setName(final String name) {
this._name = name;
}

## @Data

The annotation @Data, will turn an annotated class into a value object class. A class annotated with @Data has the following effect:

- all fields are flagged final,
- getter methods will be generated (if not existent),
- a constructor taking paramaters for all non-initialized fields will be generated (if not existent),
- equals(Object) / hashCode() methods will be generated (if not existent),
- a toString() method will be generated (if not existent).

Example:

@Data class Person {
String firstName
String lastName
}