Skip to content
/ sheeco Public

Marshalling and unmarshalling Spreadsheets to Java Objects

License

Notifications You must be signed in to change notification settings

camaral/sheeco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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);

About

Marshalling and unmarshalling Spreadsheets to Java Objects

Resources

License

Stars

Watchers

Forks

Packages

No packages published