All Projects → TrigerSoft → Jaque

TrigerSoft / Jaque

Licence: gpl-2.0
Lets Java 8 Lambdas to be represented as objects in the form of expression trees at runtime

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jaque

Dapper.lnskydb
基于Dapper的LINQ扩展,支持Lambda表达式,支持按时间分库分表,也可以自定义分库分表方法,且实体类有T4模版自动生成.省去手写实体类的麻烦。已在实际项目使用
Stars: ✭ 228 (+50%)
Mutual labels:  lambda, linq
Fluentvalidation.blazor
Fluent Validation-powered Blazor component for validating standard <EditForm> 🌌 ✅
Stars: ✭ 140 (-7.89%)
Mutual labels:  lambda, linq
lambda2js
Converts a C# expression tree (from Linq namespace) to a syntatically correct javascript code.
Stars: ✭ 51 (-66.45%)
Mutual labels:  linq, lambda
Masuit.tools
ldqk.xyz/55
Stars: ✭ 2,539 (+1570.39%)
Mutual labels:  lambda, linq
linqjs
use linq and lambda in javascript on es6, can use linq function in an Object or an Array or a String value | 一个方便对数组、字典、树形数据进行操作、筛选等操作的工具库
Stars: ✭ 17 (-88.82%)
Mutual labels:  linq, lambda
Scelta
(experimental) Syntactic sugar for variant and optional types.
Stars: ✭ 134 (-11.84%)
Mutual labels:  lambda
Gofn
Function process via docker provider (serverless minimalist)
Stars: ✭ 134 (-11.84%)
Mutual labels:  lambda
Aws Maintenance Lambda
A lambda function to send alerts (to Slack, HipChat) on AWS maintenance events.
Stars: ✭ 133 (-12.5%)
Mutual labels:  lambda
Aws Lambda List
A list of hopefully useful AWS lambdas and lambda-related resources.
Stars: ✭ 130 (-14.47%)
Mutual labels:  lambda
Motif
Scala-like pattern matching for Java 8
Stars: ✭ 149 (-1.97%)
Mutual labels:  lambda
Terraform Aws Labs
Terraform template for AWS provider ☁️
Stars: ✭ 146 (-3.95%)
Mutual labels:  lambda
Data Forge Js
JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.
Stars: ✭ 139 (-8.55%)
Mutual labels:  linq
Remote.linq
Simply LINQ your remote resources...
Stars: ✭ 136 (-10.53%)
Mutual labels:  linq
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-5.92%)
Mutual labels:  lambda
Jets
Ruby on Jets
Stars: ✭ 1,915 (+1159.87%)
Mutual labels:  lambda
Designing Cloud Native Microservices On Aws
Introduce a fluent way to design cloud native microservices via EventStorming workshop, this is a hands-on workshop. Contains such topics: DDD, Event storming, Specification by example. Including the AWS product : Serverless Lambda , DynamoDB, Fargate, CloudWatch.
Stars: ✭ 131 (-13.82%)
Mutual labels:  lambda
Portkey
Live-coding the Cloud
Stars: ✭ 139 (-8.55%)
Mutual labels:  lambda
Flogo
Project Flogo is an open source ecosystem of opinionated event-driven capabilities to simplify building efficient & modern serverless functions, microservices & edge apps.
Stars: ✭ 1,891 (+1144.08%)
Mutual labels:  lambda
Moonmail
Email marketing platform for bulk emailing via Amazon SES (Google Cloud Platform and Azure coming soon)
Stars: ✭ 1,766 (+1061.84%)
Mutual labels:  lambda
Linq.extras
A set of extension methods to complement the ones from System.Linq.Enumerable
Stars: ✭ 139 (-8.55%)
Mutual labels:  linq

Average time to resolve an issue Maven Central

The project is discontinued, but inspired a strong successor.

JAva QUEry

This library enables Java 8 Lambdas to be represented as objects in the form of expression trees at runtime:

void method(Predicate<Customer> p) {
  LambdaExpression<Predicate<Customer>> parsed = LambdaExpression.parse(p);
  //Use parsed Expression Tree...
}

making it possible to create type-safe fluent interfaces, i.e. instead of:

Customer obj = ...
obj.property("name").eq("John")

one can write

method<Customer>(obj -> obj.getName() == "John")

in type-safe, refactoring friendly manner. And then the library developer will be able to parse the produced Lambda to the corresponding Expression Tree for analysis.


For example, JPA Criteria API could benefit a lot from using JaQue, e.g.:

//instead of this:
Root<Pet> pet = cq.from(Pet.class);
Join<Pet, Owner> owner = pet.join(Pet_.owners);

//it could be this:
Join<Pet, Owner> owner = pet.join(Pet::getOwners);

//and instead of this:
query.where(pet.get(Pet_.color).isNull());
query.where(builder.equal(pet.get(Pet_.name), "Fido")
	.and(builder.equal(pet.get(Pet_.color), "brown")));
	
//it could be this:
query.where(pet -> pet.getColor() == null);
query.where(pet -> (pet.getName() == "Fido") && (pet.getColor() == "brown"));

If you are looking for an oportunity to start an open source project, implementing the above should be very beneficial for a very large developer comminuty. Should you start this or any other open source project based on JaQue, I'll be happy to assist you.

How to write fluent interface with JaQue?

  • Suppose you want to reference some class property
public class Fluent<T> {

	// this interface is required to make the lambda Serializable, which removes a need for 
	// jdk.internal.lambda.dumpProxyClasses system property. See below.
	public static interface Property<T, R> extends Function<T, R>, Serializable {
	}

	public Fluent<T> property(Property<T, ?> propertyRef) {
		LambdaExpression<Function<T, ?>> parsed = LambdaExpression
				.parse(propertyRef);
		Expression body = parsed.getBody();
		Expression methodCall = body;
		
		// remove casts
		while (methodCall instanceof UnaryExpression)
			methodCall = ((UnaryExpression) methodCall).getFirst();

		// checks are omitted for brevity
		Member member = ((MemberExpression) ((InvocationExpression) methodCall)
				.getTarget()).getMember();
		
		// use member
		...
		
		return this;
	}
}
  • Now your users will be able to write
Fluent<Customer> f = new Fluent<Customer>();
f.property(Customer::getName);

Make the lambda Serializable, as shown in example above. If the lambda is not serializable, the jdk.internal.lambda.dumpProxyClasses system property must be set and point to an existing writable directory to give the parser access to the lambda byte code.

Resources

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].