public static String genCode(Class<?> beanClass) {
    CodegenContext ctx = new CodegenContext();
    ctx.setPackage(CodeGenerator.getPackage(beanClass));
    String className = accessorClassName(beanClass);
    ctx.setClassName(className);
    boolean isRecord = RecordUtils.isRecord(beanClass);
    // filter out super classes
    Collection<Descriptor> descriptors = Descriptor.getAllDescriptorsMap(beanClass, false).values();
    for (Descriptor descriptor : descriptors) {
      if (Modifier.isPrivate(descriptor.getModifiers())) {
        continue;
      }
      boolean accessible = sourcePkgLevelAccessible(descriptor.getRawType());
      {
        // getter
        String methodName = descriptor.getName();
        String codeBody;
        Class<?> returnType = accessible ? descriptor.getRawType() : Object.class;
        if (isRecord) {
          codeBody =
              StringUtils.format(
                  "return ${obj}.${fieldName}();",
                  "obj",
                  OBJ_NAME,
                  "fieldName",
                  descriptor.getName());
        } else {
          codeBody =
              StringUtils.format(
                  "return ${obj}.${fieldName};",
                  "obj",
                  OBJ_NAME,
                  "fieldName",
                  descriptor.getName());
        }
        ctx.addStaticMethod(methodName, codeBody, returnType, beanClass, OBJ_NAME);
      }
      if (accessible) {
        String methodName = descriptor.getName();
        String codeBody =
            StringUtils.format(
                "${obj}.${fieldName} = ${fieldValue};",
                "obj",
                OBJ_NAME,
                "fieldName",
                descriptor.getName(),
                "fieldValue",
                FIELD_VALUE);
        ctx.addStaticMethod(
            methodName,
            codeBody,
            void.class,
            beanClass,
            OBJ_NAME,
            descriptor.getRawType(),
            FIELD_VALUE);
      }
      // getter/setter may lose some inner state of an object, so we set them to null to avoid
      // creating getter/setter accessor.
    }

    return ctx.genCode();
  }
@Test
  public void genCode() {
    System.out.println(AccessorHelper.genCode(A.class));
    ;
  }