Manifold

The plugin update is pending JetBrains approval
Compatible with: IntelliJ IDEA Android Studio
Feb 18, 2019
1 460

What is Manifold?

Manifold is a new breed of Java tooling. It provides powerful features to make Java development more appealing and productive. Simply add the Manifold jar to your project and begin taking advantage of it.

What can you do with Manifold?

Meta-programming

Use the framework to gain direct, type-safe access to any type of metadata, such as JSON Schema and YAML. Remove the code gen step in your build process.

// Use your User.json schema file directly as a type, no code gen!
User user = User.builder("myid", "mypassword", "Scott")
  .withGender(male)
  .withDob(LocalDate.of(1987, 6, 15))
  .build();
User.request("htt://api.example.com/users").postOne(user);

Extensions

Add extension methods to existing Java classes, even String, List, and File. Eliminate boilerplate code. Check it out!

String greeting = "hello";
greeting.myMethod(); // Add your own methods to String!

Structural Typing

Unify disparate APIs. Bridge software components you do not control. Access maps through type-safe interfaces.

Map<String, Object> map = new HashMap<>();
MyThingInterface thing = (MyThingInterface) map; // O_o
thing.setFoo(new Foo());
Foo foo = thing.getFoo();
out.println(thing.getClass()); // prints "java.util.HashMap"

Type-safe Reflection

Access private features with @Jailbreak to avoid the drudgery and vulnerability of Java reflection.

@Jailbreak Foo foo = new Foo();
// Direct, *type-safe* access to *all* foo's members
foo.privateMethod(x, y, z);
foo.privateField = value;

String Templates (aka String Interpolation)

Embed variables and expressions in String literals, no more clunky string concat!

int hour = 15;
// Simple variable access with '$'
String result = "The hour is $hour"; // Yes!!!
// Use expressions with '${}'
result = "It is ${hour > 12 ? hour-12 : hour} o'clock";

Template Files with ManTL

Author template files with the full expressive power of Java, use your templates directly in your code as types.

List<User> users = ...;
String content = abc.example.UserSample.render(users);

A tempate file abc/example/UserSample.html.mtl

<%@ import java.util.List %>
<%@ import com.example.User %>
<%@ params(List<User> users) %>
<html lang="en">
<body>
<% users.stream()
   .filter(user -> user.getDateOfBirth() != null)
   .forEach(user -> { %>
    User: ${user.getName()} <br>
    DOB: ${user.getDateOfBirth()} <br>
<% }); %>
</body>
</html>

Libraries

Leverage stock Manifold extension libraries for standard Java classes. Save time and reduce boilerplate code.

File file = new File(path);
// Use refreshing extensions to File
String content = file.readText();

IntelliJ

Use the Manifold IntelliJ IDEA plugin to fully leverage Manifold in your development cycle. The plugin provides comprehensive support for IntelliJ features including code completion, navigation, usage searching, refactoring, incremental compilation, hotswap debugging, full-featured template editing, and more.

Learn More

Download plugin

Recent change notes

Manifold Ext changes:
- Structural interface improvements
-- Provide a solution to eliminate the first-time load/cast overhead for a structural interface. Enable a structural interface to provide its own proxy factory via new optional parameters to @Structural(factoryClass, baseClass)

Manifold JSON changes:
- JSON array types are now concrete types and define a component type named Item
-- Thus a JSON array declared as "Users" has type "Users" and, if not a $ref, its nested component type is named "UsersItem"
-- Before this change there was only type "Users", which was made the name of the component type
-- The "Users" type is an interface and extends IJsonList, which in extends List
-- An array property has the following representation:
--- Users getUsers();
--- void setUsers(List);
--- The parameter type is contravariant, which is useful when building up lists separate from the API
- Added `request(URL)` static method on all JSON API interfaces
-- Use to conveniently navigate an HTTP REST API with GET, POST, PUT, PATCH, & DELETE
- IJsonParser no longer wraps lists in bindings with single "value" property -- returns JSON List as-is now
- Fixed bug dealing with not preserving insertion order of oneOf/anyOf union types
- Several other bug fixes along the way

General usage instructions

http://manifold.systems/docs.html