Skip to content

Commit

Permalink
rename recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
timo-a committed Jan 1, 2025
1 parent 6bf288f commit a420044
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Value
@EqualsAndHashCode(callSuper = false)
public class ConvertCommons extends ConvertLogRecipe {
public class UseCommonsLog extends UseLogRecipeTemplate {

@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Value
@EqualsAndHashCode(callSuper = false)
public class ConvertJBoss extends ConvertLogRecipe {
public class UseJBossLog extends UseLogRecipeTemplate {

@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Value
@EqualsAndHashCode(callSuper = false)
public class ConvertUtilLog extends ConvertLogRecipe {
public class UseLog extends UseLogRecipeTemplate {

@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Value
@EqualsAndHashCode(callSuper = false)
public class ConvertLog4j2 extends ConvertLogRecipe {
public class UseLog4j2 extends UseLogRecipeTemplate {

@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.openrewrite.Recipe;

public abstract class ConvertLogRecipe extends Recipe {
public abstract class UseLogRecipeTemplate extends Recipe {

protected static final String FIELD_NAME_DESCRIPTION = "Name of the log field to replace. " +
"If not specified, the field name is not checked and any field that satisfies the other checks is converted.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Value
@EqualsAndHashCode(callSuper = false)
public class ConvertSlf4j extends ConvertLogRecipe {
public class UseSlf4j extends UseLogRecipeTemplate {

@Override
public String getDisplayName() {
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/META-INF/rewrite/use-lombok-log-catchall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright 2024 the original author or authors.
# <p>
# 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
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# 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.
#

---
type: specs.openrewrite.org/v1beta/recipe
name: io.github.timoa.lombok.log.ConvertAnyLog
displayName: Use lomboks log annotation instead of defining the field yourself
description: >-
Applies all recipes that replace logger declarations with class level annotations.
If you know which logger framework is in use you can simply use the specific recipe.
If, for some reason you need to cover all frameworks you can use this recipe.
recipeList:
- org.openrewrite.java.migrate.lombok.log.UseSlf4j
- org.openrewrite.java.migrate.lombok.log.UseCommonsLog
- org.openrewrite.java.migrate.lombok.log.UseLog4j2
- org.openrewrite.java.migrate.lombok.log.UseJBossLog
- org.openrewrite.java.migrate.lombok.log.UseLog

0 comments on commit a420044

Please sign in to comment.