Class CreateCheckerCommand

java.lang.Object
com.luchersol.cli.command.CreateCheckerCommand
All Implemented Interfaces:
Callable<Integer>

public class CreateCheckerCommand extends Object implements Callable<Integer>
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addInnerMethods(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.
    void
    addMethods(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.
    Executes the command to create a Java class.
    org.springframework.javapoet.MethodSpec
    getCheckMethod(org.springframework.javapoet.ClassName sourceClassName, org.springframework.javapoet.ClassName targetClassName)
    Generates the check() method for the checker class.
    org.springframework.javapoet.MethodSpec
    getConstructor(org.springframework.javapoet.ClassName sourceClassName)
    Generates a constructor method for the checker class.
    org.springframework.javapoet.MethodSpec
    getSelfMethod(org.springframework.javapoet.ClassName targetClassName)
    Generates the self() method for the checker class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      call in interface Callable<Integer>
      Returns:
      0 if the command executes successfully
      Throws:
      IOException - if an input/output error occurs during execution
      ClassNotFoundException
    • 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 MethodSpec for 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 MethodSpec for 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 class
      targetClassName - the class name of the target checker class
      Returns:
      a MethodSpec for 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 - the TypeSpec.Builder for the checker class
      sourceClassName - the class name of the source class
      targetClassName - 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 - the TypeSpec.Builder for the checker class
      sourceClassName - the class name of the source class
      targetClassName - the class name of the target checker class
      Throws:
      ClassNotFoundException - if the source class cannot be found