Gipsy

Groovy version of Jipsy, a configurable AST Transformation to simplify the use of the Service Provider Interface.

License

License

GroupId

GroupId

org.kordamp.gipsy
ArtifactId

ArtifactId

gipsy
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Gipsy
Groovy version of Jipsy, a configurable AST Transformation to simplify the use of the Service Provider Interface.
Project URL

Project URL

https://github.com/kordamp/gipsy
Source Code Management

Source Code Management

https://github.com/kordamp/gipsy

Download gipsy

How to add to project

<!-- https://jarcasting.com/artifacts/org.kordamp.gipsy/gipsy/ -->
<dependency>
    <groupId>org.kordamp.gipsy</groupId>
    <artifactId>gipsy</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.kordamp.gipsy/gipsy/
implementation 'org.kordamp.gipsy:gipsy:1.1.1'
// https://jarcasting.com/artifacts/org.kordamp.gipsy/gipsy/
implementation ("org.kordamp.gipsy:gipsy:1.1.1")
'org.kordamp.gipsy:gipsy:jar:1.1.1'
<dependency org="org.kordamp.gipsy" name="gipsy" rev="1.1.1">
  <artifact name="gipsy" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.kordamp.gipsy', module='gipsy', version='1.1.1')
)
libraryDependencies += "org.kordamp.gipsy" % "gipsy" % "1.1.1"
[org.kordamp.gipsy/gipsy "1.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.kordamp.jipsy : jipsy-processor jar 1.1.1

Project Modules

There are no modules declared in this project.

Gipsy

gipsy logo

Build Status Download


Groovy version of Jipsy, a configurable AST Transformation to simplify the use of the Service Provider Interface.

Introduction

Gipsy delivers the same functionality that Jipsy does but uses Groovy’s AST Transformations instead of JDK6' Annotation Processor.

As explained at the service loader documentation, services must follow certain rules in order to be considered as such; they also must be registered using an standard location based on a naming convention. The following rules apply to classes that may be considered services

  1. The class must implement at least one target interface (the service interface).

  2. The class must provide a no-args constructor.

  3. The class must be public.

  4. The class name should be added to a file named META-INF/services/<target_interface_name>

This library provides a mechanism for enforcing those rules by simply adding an annotation on each service implementation, for example say there exists the following Calculator service interface

package com.acme

interface Calculator {
    double add(double a, double b)
}

A basic implementation of such service may be as follows

package com.acme

@org.kordamp.jipsy.annotations.ServiceProviderFor(Calculator)
class BasicCalculator implements Calculator {
    double add(double a, double b) { a + b }
}

Notice that Gipsy reuses the same annotations from Jipsy. Compile your code. If you look closely at your project’s output you’ll see a file named META-INF/services/com.acme.Calculator whose contents should look similar to

# Generated by org.kordamp.gipsy.transform.service.ServiceProviderProcessor (1.1.1)
com.acme.BasicCalculator

Et voilà! There are no additional sources to be touched nor files to be created; Jipsy will take care of the boiler plate.

Installing

Gipsy requires the following dependencies

  • jipsy-processor-1.1.1

  • groovy-all-3.0.7

Gipsy can be downloaded directly from Maven Central, configure it via Maven or Gradle.

Maven
<dependency>
    <groupId>org.kordamp.gipsy</groupId>
    <artifactId>gipsy</artifactId>
    <version>1.1.1</version>
    <scope>provided</scope>
</dependency>
Gradle
dependencies {
    annotationProcessor 'org.kordamp.gipsy:gipsy:1.1.1'
    compileOnly 'org.kordamp.jipsy:jipsy-annotations:1.1.1'
}

Creating Your Own AST Transformations

TBD

org.kordamp.gipsy

Kordamp

Versions

Version
1.1.1
1.1.0
1.0.0
0.6.0
0.5.0
0.4.1