Giter Club home page Giter Club logo

manifold's Introduction

Gitter Maven Central

What is Manifold?

Manifold re-energizes Java with powerful features like Type-safe Metaprogramming, Structural Typing, and Extension Methods. Simply add the Manifold jar to your project and begin taking advantage of it.

What can you do with Manifold?

Use the framework to gain direct, type-safe access to any type of metadata, such as GraphQL, 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);

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!

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"

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;

Simply add the exceptions plugin argument: -Xplugin:Manifold stringsexceptions. Now checked exceptions behave like unchecked exceptions! No more compiler errors, no more boilerplate try/catch nonsense.

List<String> strings = ...;
List<URL> urls = list
  .map(URL::new) // No need to handle the MalformedURLException!
  .collect(Collectors.toList());

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";

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>

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();

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.

Gitter

manifold's People

Contributors

rsmckinney avatar vsch avatar artsiomch avatar dpukyle avatar bbjubjub2494 avatar culmat avatar

Watchers

Spencer Tom Tafadzwa Chirume avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.