io.slugstack.rewritejavarecipes.internal.util.TreeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rewrite-java-recipes Show documentation
Show all versions of rewrite-java-recipes Show documentation
slugstack-rewrite-java-recipes description from within rewrite-java-recipes
package io.slugstack.rewritejavarecipes.internal.util;
import org.openrewrite.java.tree.J;
import java.util.Optional;
public class TreeUtils {
@SuppressWarnings("unchecked")
public static Optional whenType(Class treeType, J j) {
return treeType.isAssignableFrom(j.getClass()) ? Optional.of((T) j) : Optional.empty();
}
}