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

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

There is a newer version: 8.42.0
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 org.jspecify.annotations.Nullable; import org.openrewrite.SourceFile; import org.openrewrite.quark.Quark; import org.openrewrite.quark.QuarkParser; import org.openrewrite.text.PlainText; import org.openrewrite.text.PlainTextParser; import java.util.function.Consumer; @SuppressWarnings("unused") public interface SourceSpecs extends Iterable> { static SourceSpecs dir(String dir, SourceSpecs... sources) { return dir(dir, s -> { }, sources); } static SourceSpecs dir(String dir, Consumer> spec, SourceSpecs... sources) { return new Dir(dir, spec, sources); } static SourceSpecs other(@Nullable String before) { return other(before, s -> { }); } static SourceSpecs other(@Nullable String before, Consumer> spec) { SourceSpec quark = new SourceSpec<>(Quark.class, null, QuarkParser.builder(), before, null); spec.accept(quark); return quark; } static SourceSpecs other(@Nullable String before, @Nullable String after) { return other(before, after, s -> { }); } static SourceSpecs other(@Nullable String before, @Nullable String after, Consumer> spec) { SourceSpec quark = new SourceSpec<>(Quark.class, null, QuarkParser.builder(), before, s -> after); spec.accept(quark); return quark; } static SourceSpecs text(@Nullable String before) { return text(before, s -> { }); } static SourceSpecs text(@Nullable String before, Consumer> spec) { SourceSpec

text = new SourceSpec<>(PlainText.class, null, PlainTextParser.builder(), before, null); spec.accept(text); return text; } static SourceSpecs text(@Nullable String before, @Nullable String after) { return text(before, after, s -> { }); } static SourceSpecs text(@Nullable String before, @Nullable String after, Consumer<SourceSpec<PlainText>> spec) { SourceSpec<PlainText> text = new SourceSpec<>(PlainText.class, null, PlainTextParser.builder(), before, s-> after); spec.accept(text); return text; } } </code></pre> <br/> <br/> <div class='clear'></div> </main> </div> <br/><br/> <div class="align-center">&copy; 2015 - 2025 <a href="/legal-notice.php">Weber Informatics LLC</a>&nbsp;|&nbsp;<a href="/data-protection.php">Privacy Policy</a></div> <br/><br/><br/><br/><br/><br/> </body> </html>