Example programs and applications
We're collecting examples here.
Examples of client-side Ceylon
We have three small demo application which illustrate the use of Ceylon in a web browser:
Examples of Ceylon on mobile platforms
This example project shows how to use Ceylon to create an Android application in Android Studio. It uses the Ceylon Gradle plugin for Android to integrate with the Android toolchain.
The Universal Media Player is a much more elaborate sample, but depends on Ceylon 1.3.3, which is not yet released. The process of developing the example application is discussed in this presentation.
Examples of server-side Ceylon
Ceylon is a fantastic language for writing microservices:
Wildfly Swarm and Ceylon demonstrates the use of Ceylon
to write a Java EE-based microservice for Swarm, using
JPA, CDI, and JAX-RS, and of the
ceylon swarmcommand to package it as a "fat" jar. Alternatively, you can use
ceylon warto package it as a web archive and run it on a Java EE application server! The technologies demonstrated here are discussed in this presentation.
- Spring Boot and Ceylon demonstrates the use of Ceylon with Spring Boot and Spring Data.
- The Vert.x examples include several samples showing how to use Ceylon in Vert.x.
- Spark with Ceylon demonstrates how to use the Spark web framework in Ceylon.
- Jooby with Ceylon contains two very simple examples of the Jooby web framework.
- The gyokuro demos show off the gyokuro web framework, which is written in Ceylon.
- The Vaadin JAAS example demonstrates how to write a Java EE web application using Vaadin and JAAS.
Documentation for Ceylon and Vert.x can be found at the Vert.x site.
Examples of full-stack applications
- The Ceylon Web IDE is a great example of how to build a modern web application using Ceylon, making use of Ceylon's HTTP and JSON APIs, and interoperation with native Java libraries. The example even supports deployment to the OpenShift cloud platform.
- The Ceylon DDDSample demonstrates the use of Ceylon to write a complete Java EE application, making use of JPA, CDI, EJB, JAX-RS, JMS, JSF, and Facelets.
Learn how to use Ceylon with these Java frameworks:
- JDK Collections and Streams in Ceylon shows how easy and natural it is to use Java's collections and streams APIs directly from Ceylon.
- Java Persistence in Ceylon demonstrates the use of JPA for Object/Relational Mapping.
- For Java-style dependency injection, check out Weld and Guice with Ceylon, based on this blog post.
- The JavaFX Samples for Ceylon show how to write a JavaFX UI in Ceylon.
- The RxJava examples project is a port of the basic RxJava examples from the RxJava documentation to Ceylon.
- OpenGL in Ceylon shows the use of JOGL in a Swing application.
- This IntelliJ UI designer example shows how to use IntelliJ IDEA's GUI Designer.
- The jOOQ Ceylon example demonstrates the use of the jOOQ library, as documented in this blog post.
- The Ceylon LWJGL samples project demonstrates the use of the Lightweight Java Game Library.
The Ceylon OSGi examples demonstrate how to use Ceylon modules as OSGi bundles, and how to:
- run the Ceylon HTTP server inside an OSGi container,
- call standard OSGi services,
- integrate with Pax Web in order to produce a web application packaged as a single Ceylon module, or
- write an Eclipse plugin.
Examples of libraries
The Ceylon SDK includes plenty of good examples of Ceylon code, including:
ceylon.collectiondemonstrates some very typical usage of generics.
ceylon.filedemonstrates the use of enumerated types and shows how to wrap a native Java API.
ceylon.regexis a cross-platform module that demonstrates the use of
ceylon.localeis a cross-platform module that demonstrates the use of resource loading.
ceylon.testdemonstrates some very typical usage of the metamodel.
ceylon.promisedemonstrates advanced use of abstraction over function types.
ceylon.jsonillustrates a rather cool use of union types.
A plugin for the
ceylon command is a great way to improve
ceylon swarmis a super-simple plugin that just wraps an existing Java library.
ceylon formatis much more elaborate.
Examples of real life warts-'n-all production code
The Ceylon IDE Common and Ceylon IDE for IntelliJ projects sure aren't beautiful polished example code, but they do show how cleanly Ceylon interoperates with hairy, real-world, legacy Java APIs.
The Ceylon plugin for VS Code exhibits a whole completely different approach to implementing tooling in Ceylon.
The Ceylon Dart project shows that it's possible to write a whole backend for the Ceylon compiler in Ceylon.