Create Java class

Apache 2.0

Create a new, empty Java class.

org.openrewrite.java.CreateEmptyJavaClass

Required

The source root of the new class file.

The package of the new class.

The class modifier.

File path of new file.

Optional

overwriteExistingBoolean

If there is an existing file, should it be overwritten.

Directory path of new class.

mod run . --recipe=org.openrewrite.java.CreateEmptyJavaClass \ -P sourceRoot=src/main/java \ -P packageName=org.openrewrite.example \ -P modifier=public \ -P className=ExampleClass

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.