Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.57 KB

README.md

File metadata and controls

60 lines (47 loc) · 1.57 KB

sheeco

Codacy Badge Build Status

Marshalling and unmarshalling Excel Spreadsheets to Java Objects using annotations. It takes only 4 steps to start using it.

  1. Add maven dependency to your project.
<dependency>
  <groupId>com.github.camaral</groupId>
  <artifactId>sheeco</artifactId>
  <version>1.0</version>
</dependency>
  1. Create a Excel spreadsheet.
name Male? Birth date hairLength hairColor hairLength hairColor
Floofly false 2014/12/12 1 orange 1 yellow
Tor true 2014/11/11 3 black 0 grey
  1. Describe the Excel spread sheet on Java classes.
@SpreadsheetPayload(name = "Cat")
public class Cat {
	@SpreadsheetAttribute(index = 0)
	String name;
	@SpreadsheetAttribute(index = 1, name="Male?")
	Boolean male;
	@SpreadsheetAttribute(index = 2, name="Birth date")
	Date birthDate;

	@SpreadsheetElement(index = 3)
	Fur body;
	@SpreadsheetElement(index = 5)
	Fur tail;
}
@SpreadsheetPayload(name = "Fur")
public class Fur {
	@SpreadsheetAttribute(index = 0)
	private Integer hairLength;
	@SpreadsheetAttribute(index = 1)
	private String hairColor;
}
  1. Read the spreadsheet from a File or from an InputStream.
List<Cat> cats = Sheeco.fromSpreadsheet(new File(cats.xls), Cat.class);