Skip to content

nipafx/demo-jigsaw-advent-calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Jigsaw Advent Calendar 🎄

This demo project contains the code for a post for the Java Advent Calendar (which I published in on my blog as well). It showcases a couple of features of Project Jigsaw.

The code is released into the public domain via CC0 so it can be used without any limitations.

😴 This demo project is no longer maintained. It is superseeded by a simpler "Hello World" example and the more well-rounded ServiceMonitor application. 😴

The Advent Calendar

Even though I do my best to ignore the whole christmas kerfuffle, it seemed prudent to have the demo uphold "the spirit of the season". So it models an advent calendar:

  • There is a Calendar, which has 24 CalendarSheets.
  • Each sheet knows its day of the month and contains a Surprise.
  • The death march towards Christmas is symbolized by printing the sheets (and thus the surprises) to the console.

Of course the calendar needs to be created first. It can do that by itself but it needs the means to create surprises. To this end it requires a List<SurpriseFactory>.

Sections

The demo consists of several sections, each building on the previous ones. There is a branch for each section.

  • 0️⃣ Before Jigsaw: describes the application's organization before Jigsaw
  • 1️⃣ Creating A Module: moves the application into Jigsaw land by moving it into a single module
  • 2️⃣ Splitting Into Modules: explores more of Jigsaw's core features by splitting the application into several modules
  • 3️⃣ Services: introduces services and the ServiceLocator for loose coupling between modules
  • 4️⃣ Automatic Modules: shows how modules can depend on non-modularized JARs
  • 5️⃣ Optional Dependencies: demonstrates dependencies that are mandatory at compile time but are not required at run time

Setup

This demo (obviously) requires Java 9. For it to work the Java 9 variants of javac, jar, and java must be available on the command line via javac9, jar9, and java9, e.g. by symlinking them.

The root directory contains a compileAndRun.sh, which - surprise - compiles and runs the example.

About

An Advent Calendar Demonstrating Jigsaw EA

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published