All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.java.method.reference.JavaLambdaMethodReferenceFilter Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.java.method.reference;

import com.softicar.platform.common.core.java.classes.name.JavaClassName;
import java.lang.invoke.LambdaMetafactory;

/**
 * Default implementation of {@link IJavaMethodReferenceFilter}.
 * 

* This filters all generated lambda methods and all methods of * {@link LambdaMetafactory}. * * @author Oliver Richers */ public class JavaLambdaMethodReferenceFilter implements IJavaMethodReferenceFilter { private static final String LAMBDA_METHOD_NAME_PREFIX = "lambda$"; private static final JavaClassName LAMBDA_METAFACTORY_CLASSNAME = new JavaClassName(LambdaMetafactory.class); @Override public boolean test(JavaMethodReference methodReference) { return !isLambdaMethod(methodReference) && !isLambdaMetafactory(methodReference); } private boolean isLambdaMethod(JavaMethodReference methodReference) { return methodReference.getMethodName().startsWith(LAMBDA_METHOD_NAME_PREFIX); } private boolean isLambdaMetafactory(JavaMethodReference methodReference) { return methodReference.getOwner().equals(LAMBDA_METAFACTORY_CLASSNAME); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy