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

org.openrewrite.test.AdHocScanningRecipe Maven / Gradle / Ivy

There is a newer version: 8.40.2
Show newest version
/*
 * Copyright 2022 the original author or authors.
 * 

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* https://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.openrewrite.test; import lombok.EqualsAndHashCode; import lombok.Value; import lombok.With; import org.intellij.lang.annotations.Language; import org.jspecify.annotations.Nullable; import org.openrewrite.*; import org.openrewrite.internal.StringUtils; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.function.Supplier; @Value @EqualsAndHashCode(callSuper = false) public class AdHocScanningRecipe extends ScanningRecipe { @With @Nullable @Language("markdown") String displayName; @With @Nullable String name; @With @Nullable Boolean causesAnotherCycle; @With Supplier> getVisitor; @Nullable @With Supplier> generator; @With @Nullable List maintainers; @With @Nullable Integer maxCycles; @Override public String getDisplayName() { return StringUtils.isBlank(displayName) ? "Ad hoc recipe" : displayName; } @Override public String getDescription() { return "An ad hoc recipe used in RewriteTest."; } @Override public String getName() { return StringUtils.isBlank(name) ? super.getName() : name; } @Override public boolean causesAnotherCycle() { return causesAnotherCycle == null ? super.causesAnotherCycle() : causesAnotherCycle; } @Override public int maxCycles() { return maxCycles == null ? super.maxCycles() : maxCycles; } @Override public List getMaintainers() { return maintainers == null ? Collections.emptyList() : maintainers; } @Override public Void getInitialValue(ExecutionContext ctx) { return null; } @Override public TreeVisitor getScanner(Void acc) { return TreeVisitor.noop(); } @Override public Collection generate(Void acc, ExecutionContext ctx) { return generator == null ? Collections.emptyList() : generator.get(); } @Override public TreeVisitor getVisitor(Void acc) { return getVisitor.get(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy