DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Eclipse Template Example

05.20.2009
| 4079 views |
  • submit to reddit
        // Template to generate accessors to a List in the current class
	public Integer get${F:field(java.util.List)}Length() {
		return ${f:field(java.util.List)}.size();
	}
	public void add${F:field(java.util.List)}(${t:elemType(f)} ${f:field(java.util.List)}) {
		this.${f:field(java.util.List)}.add(${f:field(java.util.List)});
	}
	public boolean remove${F:field(java.util.List)}(Integer index) {
		return this.${f:field(java.util.List)}.remove(index);
	}
	public ${t:elemType(f)} get${F:field(java.util.List)}(Integer index) {
		return this.${f:field(java.util.List)}.get(index);
	}