Class CreateCheckerCommand
java.lang.Object
com.luchersol.cli.command.CreateCheckerCommand
Subcommand for creating a Java class.
This command generates a Java class with the specified name and package.
Example usage:
java -jar my-application.jar create-classes -c com.example.MyClass -n CheckerMyClass -p com.example.checker
Options:
- -sp, --source-package <PACKAGE_NAME> :
- -sc, --source-class <CHECKER_NAME> :
- -tp, --target-package <PACKAGE_NAME> :
- -tc, --target-class <CLASS_NAME> :
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInnerMethods(org.springframework.javapoet.TypeSpec.Builder builder, org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) Adds inner methods based on the public boolean methods of the source class.voidaddMethods(org.springframework.javapoet.TypeSpec.Builder builder, org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) Adds the main methods to the checker class builder.call()Executes the command to create a Java class.org.springframework.javapoet.MethodSpecgetCheckMethod(org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) Generates the check() method for the checker class.org.springframework.javapoet.MethodSpecgetConstructor(org.springframework.javapoet.ClassName sourceClassName) Generates a constructor method for the checker class.org.springframework.javapoet.MethodSpecgetSelfMethod(org.springframework.javapoet.ClassName targetClassName) Generates the self() method for the checker class.
-
Constructor Details
-
CreateCheckerCommand
public CreateCheckerCommand()
-
-
Method Details
-
call
Executes the command to create a Java class.Currently, this method does not implement the class generation logic and simply returns 0.
- Specified by:
callin interfaceCallable<Integer>- Returns:
- 0 if the command executes successfully
- Throws:
IOException- if an input/output error occurs during executionClassNotFoundException
-
getConstructor
public org.springframework.javapoet.MethodSpec getConstructor(org.springframework.javapoet.ClassName sourceClassName) Generates a constructor method for the checker class.- Parameters:
sourceClassName- the class name of the source class- Returns:
- a
MethodSpecfor the constructor
-
getSelfMethod
public org.springframework.javapoet.MethodSpec getSelfMethod(org.springframework.javapoet.ClassName targetClassName) Generates the self() method for the checker class.- Parameters:
targetClassName- the class name of the target checker class- Returns:
- a
MethodSpecfor the self method
-
getCheckMethod
public org.springframework.javapoet.MethodSpec getCheckMethod(org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) Generates the check() method for the checker class.- Parameters:
sourceClassName- the class name of the source classtargetClassName- the class name of the target checker class- Returns:
- a
MethodSpecfor the check method
-
addMethods
public void addMethods(org.springframework.javapoet.TypeSpec.Builder builder, org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) throws ClassNotFoundException Adds the main methods to the checker class builder.- Parameters:
builder- theTypeSpec.Builderfor the checker classsourceClassName- the class name of the source classtargetClassName- the class name of the target checker class- Throws:
ClassNotFoundException- if the source class cannot be found
-
addInnerMethods
public void addInnerMethods(org.springframework.javapoet.TypeSpec.Builder builder, org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName) throws ClassNotFoundException Adds inner methods based on the public boolean methods of the source class.- Parameters:
builder- theTypeSpec.Builderfor the checker classsourceClassName- the class name of the source classtargetClassName- the class name of the target checker class- Throws:
ClassNotFoundException- if the source class cannot be found
-