-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathAnotherDummyRecipe.java
90 lines (77 loc) · 2.96 KB
/
AnotherDummyRecipe.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright 2021 - 2023 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 io.example.recipes;
import lombok.RequiredArgsConstructor;
import org.openrewrite.Contributor;
import org.openrewrite.Maintainer;
import org.openrewrite.Option;
import org.openrewrite.Recipe;
import org.openrewrite.config.RecipeExample;
import java.util.List;
import java.util.Set;
/**
* @author Fabian Krüger
*/
@RequiredArgsConstructor
public class AnotherDummyRecipe extends Recipe {
@Option(
displayName = "Property key",
description = "The property key to add.",
example = "some.example"
)
private final String property;
@Option(
displayName = "Property value",
description = "The value of the new property key."
)
private final String value;
@Override
public String getDisplayName() {
return "AnotherDummyRecipe";
}
@Override
public String getDescription() {
return "Description of AnotherDummyRecipe";
}
@Override
public List<Contributor> getContributors() {
return List.of(new Contributor("Fabian Krüger", "[email protected]", 1), new Contributor("Mike Wazowski", "[email protected]", 1000));
}
@Override
public List<Maintainer> getMaintainers() {
return List.of(new Maintainer("Spring", null), new Maintainer("SBM", null));
}
@Override
public List<RecipeExample> getExamples() {
RecipeExample example1 = new RecipeExample();
example1.setDescription("The recipe example description");
example1.setParameters(List.of("param1", "param2"));
RecipeExample.Source source1 = new RecipeExample.Source("foo", "bar", "the/path", "java");
RecipeExample.Source source2 = new RecipeExample.Source("bim", "bam", "another/path", "kotlin");
example1.setSources(List.of(source1, source2));
RecipeExample example2 = new RecipeExample();
example2.setDescription("The recipe example description");
example2.setParameters(List.of("param1", "param2"));
RecipeExample.Source source3 = new RecipeExample.Source("a", "b", "the/path", "java");
RecipeExample.Source source4 = new RecipeExample.Source("0", "1", "another/path", "kotlin");
example1.setSources(List.of(source3, source4));
return List.of(example1, example2);
}
@Override
public Set<String> getTags() {
return Set.of("Java", "Example");
}
}