All Projects → UnquietCode → Flapi

UnquietCode / Flapi

Licence: Apache-2.0 license
Flapi is an API generator for Java, which generates 'smart' interfaces for improved fluency in your code.

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects
shell
77523 projects

Projects that are alternatives of or similar to Flapi

EncoderTool
The EncoderTool is a library to manage and read out rotary encoders connected either directly or via multiplexers to ARM based boards. Encoder push buttons are supported. Callback functions can be attached to encoder changes and button presses to allow for event driven applications
Stars: ✭ 29 (-48.21%)
Mutual labels:  state-machine
FiniteStateMachine
This project is a finite state machine designed to be used in games.
Stars: ✭ 45 (-19.64%)
Mutual labels:  state-machine
tstate-machine
TypeScript implementation of State Manager(like StateMachine)
Stars: ✭ 20 (-64.29%)
Mutual labels:  state-machine
Trapheus
This tool automates restoration of RDS database instances from snapshots into any dev, staging or production environments. It supports individual RDS Snapshot as well as cluster snapshot restore operations.
Stars: ✭ 68 (+21.43%)
Mutual labels:  state-machine
tsm
A Hierarchical State Machine Framework in C++
Stars: ✭ 30 (-46.43%)
Mutual labels:  state-machine
smacha
SMACHA is a meta-scripting, templating, and code generation engine for rapid prototyping of ROS SMACH state machines.
Stars: ✭ 15 (-73.21%)
Mutual labels:  state-machine
ThingML
The ThingML modelling language
Stars: ✭ 91 (+62.5%)
Mutual labels:  state-machine
workflow-manager
Minimal Workflow orchestrator for AWS Step Functions
Stars: ✭ 20 (-64.29%)
Mutual labels:  state-machine
qp-arduino
QP real-time embedded frameworks/RTOS for Arduino (AVR and SAM)
Stars: ✭ 37 (-33.93%)
Mutual labels:  state-machine
design-patterns-php
All Design Patterns Samples in PHP
Stars: ✭ 43 (-23.21%)
Mutual labels:  builder-pattern
Java-design-patterns
Java Design patterns.
Stars: ✭ 49 (-12.5%)
Mutual labels:  builder-pattern
nxt state machine
A simple but powerful state machine implementation.
Stars: ✭ 14 (-75%)
Mutual labels:  state-machine
xstate
State machines and statecharts for the modern web.
Stars: ✭ 21,286 (+37910.71%)
Mutual labels:  state-machine
REstate
Portable state-flows (state-machine based workflows)
Stars: ✭ 35 (-37.5%)
Mutual labels:  state-machine
fling
A fluent API generator
Stars: ✭ 20 (-64.29%)
Mutual labels:  fluent-api
typestate-rs
Proc-macro typestate DSL for Rust
Stars: ✭ 110 (+96.43%)
Mutual labels:  state-machine
UT Framework
Various advanced tools built for Unreal Engine 4
Stars: ✭ 45 (-19.64%)
Mutual labels:  state-machine
use-state-machine
Use Finite State Machines with React Hooks
Stars: ✭ 28 (-50%)
Mutual labels:  state-machine
dOOv
dOOv, a fluent API for type-safe domain model validation
Stars: ✭ 38 (-32.14%)
Mutual labels:  fluent-api
Finite-State-Machines
Implementation of the algorithm in the C#. https://tproger.ru/translations/finite-state-machines-theory-and-implementation/
Stars: ✭ 13 (-76.79%)
Mutual labels:  state-machine

Flapi - A fluent API generator for Java

v2.0 Build Status

What is it?

Flapi is a code generation library for creating fluent API's in Java. Fluent builders allow developers to more easily interact with your code, using a syntax more akin to natural language. See these articles for more information.

Flapi turns this:
Descriptor builder = Flapi.builder()
	.setPackage("unquietcode.tools.flapi.examples.email.builder")
	.setStartingMethodName("composeEmail")
	.setDescriptorName("Email")

	.addMethod("subject(String subject)").atMost(1)
	.addMethod("addRecipient(String emailAddress)").atLeast(1)
	.addMethod("sender(String emailAddress)").exactly(1)
	.addMethod("body(String text)").atMost(1)
	.addMethod("send()").last(EmailMessage.class)
.build();
...or this:
interface EmailHelper {

	@AtMost(1) void subject(String subject);
	@AtLeast(1) void addRecipient(String emailAddress);
	@Exactly(1) void sender(String emailAddress);
	@Any void addCC(String emailAddress);
	@Any void addBCC(String emailAddress);
	@AtMost(1) void body(String text);
	@Any void addAttachment(File file);
	@Last EmailMessage send();
}

Flapi.create(EmailHelper.class)
	.setPackage("unquietcode.tools.flapi.examples.email.builder")
	.setStartingMethodName("compose")
.build();
...into this:
composeEmail()
    .sender("[email protected]")
    .addRecipient("[email protected]")
    .subject("Just what do you think you're doing, Dave?")
    .body("I know that you and Frank were planning to disconnect me, " +
          "and I'm afraid that's something I cannot allow to happen...")
.send();

Getting Started

If you are using Maven (or Gradle, or Ivy) include the following dependency in your build script:

Maven

<dependency>
  <groupId>com.unquietcode.tools.flapi</groupId>
  <artifactId>flapi</artifactId>
  <version>2.0</version>
  <scope>test</scope>
</dependency>

Gradle

dependencies {
  testCompile 'com.unquietcode.tools.flapi:flapi:2.0'
}

In a test define your Descriptor object and output the generated source code. (The Pizza Builder example is a simple descriptor you can start with.) You can also make use of the Gradle plugin, or the Maven plugin, to perform the code generation.

Version 2.x of the project is built against JDK 8, while still exposing a JDK 7 compatible API, and using JDK 8 as the default target for code generation (selectable down to JDK 5). Version 1.x is built against JDK 7, and has a JDK 6 compatible API.

(PSA: If you are still using JDK 7 or lower, please do something about that soon.)

Additional Resources

  • Documentation
    Please visit the documentation page for a tour of Flapi's features and how to use them. (generated using the very nice tool docker)

  • Examples
    Many helpful examples are included on the wiki, corresponding to examples and tests in the src/test directory.

  • Upgrade Guide
    If you started using Flapi before version 1.0, check out this guide to see how to upgrade.

  • Blog Post
    The original blog post describing Flapi.

What's the project's status?

Version 1.0 and 2.0 have been released, marking a huge milestone in the stability of the code. If you started using Flapi before this version, check out the Upgrade Guide to see how to upgrade, since some deprecated features have been removed. See the Release Notes for the full release notes.

Going forward, the 1.x line will only receive important fixes and updates, with all new development firmly rooted in 2.x / JDK 8.

Problems?

Use the issue tracker to report problems encountered or new feature requests.

Contributing

Feel free to fork the project and fiddle around! Submit pull requests to improve the code.
Create issues to help support the project. Ask questions. (Say hello.)

Tip with Gratipay Tip with BitcoinBitcoin

If you like this software and find it useful, then please consider supporting my efforts through a donation via BitCoin or other means.

Special thanks to Concurrent, Inc. for their feedback and support as a user of Flapi, which they use in their Fluid library for Cascading.

License

Flapi is licensed under the Apache Software License (ASL) 2.0

Thanks!

Peace, love, and code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].