public void generateKafkaTopics(String cid) {

        stringBuffer.append(TEXT_18);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_19);

        if (tKafkaInputUtil.getKafkaTopics().isEmpty()) {

          stringBuffer.append(TEXT_20);

        } else {
          for (String kafkaTopic : tKafkaInputUtil.getKafkaTopics()) {

            stringBuffer.append(TEXT_21);
            stringBuffer.append(cid);
            stringBuffer.append(TEXT_22);
            stringBuffer.append(kafkaTopic);
            stringBuffer.append(TEXT_23);
          } // end for
        } // end else
      } // end generateKafkaTopics
      public void generateKafkaProperties(String cid) {

        stringBuffer.append(TEXT_3);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_4);

        if (tKafkaInputUtil.getBrokerList() == null || "".equals(tKafkaInputUtil.getBrokerList())) {

          stringBuffer.append(TEXT_5);

        } else {

          stringBuffer.append(TEXT_6);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_7);
          stringBuffer.append(tKafkaInputUtil.getBrokerList());
          stringBuffer.append(TEXT_8);

          for (Entry<String, String> kafkaProperty :
              tKafkaInputUtil.getKafkaConsumerProperties().entrySet()) {

            stringBuffer.append(TEXT_9);
            stringBuffer.append(cid);
            stringBuffer.append(TEXT_10);
            stringBuffer.append(kafkaProperty.getKey());
            stringBuffer.append(TEXT_11);
            stringBuffer.append(kafkaProperty.getValue());
            stringBuffer.append(TEXT_12);
          } // end for
        } // end else

        stringBuffer.append(TEXT_13);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_14);
        stringBuffer.append(tKafkaInputUtil.getEncoding());
        stringBuffer.append(TEXT_15);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_16);
        stringBuffer.append(tKafkaInputUtil.getAutoOffsetReset());
        stringBuffer.append(TEXT_17);
      } // end generateKafkaProperties
  public String generate(Object argument) {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
    stringBuffer.append(TEXT_2);

    /**
     * This is a Javajet helper class meant to mutualize code generation for tKafkaXXXInput
     * components. These components share several parameters : - the Kafka consumer properties - the
     * list of Kafka topics to read from
     *
     * <p>Each tKafkaXXXInput_sparkstreamingconfig.javajet should at least import this file to avoid
     * code duplication.
     */
    final class TKafkaInputHelper {

      private TKafkaInputUtil tKafkaInputUtil;

      public TKafkaInputHelper(TKafkaInputUtil util) {
        tKafkaInputUtil = util;
      }

      public void generateKafkaProperties(String cid) {

        stringBuffer.append(TEXT_3);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_4);

        if (tKafkaInputUtil.getBrokerList() == null || "".equals(tKafkaInputUtil.getBrokerList())) {

          stringBuffer.append(TEXT_5);

        } else {

          stringBuffer.append(TEXT_6);
          stringBuffer.append(cid);
          stringBuffer.append(TEXT_7);
          stringBuffer.append(tKafkaInputUtil.getBrokerList());
          stringBuffer.append(TEXT_8);

          for (Entry<String, String> kafkaProperty :
              tKafkaInputUtil.getKafkaConsumerProperties().entrySet()) {

            stringBuffer.append(TEXT_9);
            stringBuffer.append(cid);
            stringBuffer.append(TEXT_10);
            stringBuffer.append(kafkaProperty.getKey());
            stringBuffer.append(TEXT_11);
            stringBuffer.append(kafkaProperty.getValue());
            stringBuffer.append(TEXT_12);
          } // end for
        } // end else

        stringBuffer.append(TEXT_13);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_14);
        stringBuffer.append(tKafkaInputUtil.getEncoding());
        stringBuffer.append(TEXT_15);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_16);
        stringBuffer.append(tKafkaInputUtil.getAutoOffsetReset());
        stringBuffer.append(TEXT_17);
      } // end generateKafkaProperties

      public void generateKafkaTopics(String cid) {

        stringBuffer.append(TEXT_18);
        stringBuffer.append(cid);
        stringBuffer.append(TEXT_19);

        if (tKafkaInputUtil.getKafkaTopics().isEmpty()) {

          stringBuffer.append(TEXT_20);

        } else {
          for (String kafkaTopic : tKafkaInputUtil.getKafkaTopics()) {

            stringBuffer.append(TEXT_21);
            stringBuffer.append(cid);
            stringBuffer.append(TEXT_22);
            stringBuffer.append(kafkaTopic);
            stringBuffer.append(TEXT_23);
          } // end for
        } // end else
      } // end generateKafkaTopics
    } // end class TKafkaInputHelper

    stringBuffer.append(TEXT_24);

    BigDataCodeGeneratorArgument codeGenArgument = (BigDataCodeGeneratorArgument) argument;
    INode node = (INode) codeGenArgument.getArgument();
    String cid = node.getUniqueName();

    TKafkaInputUtil tKafkaInputUtil = new TKafkaInputUtil(node);
    TKafkaInputHelper tKafkaInputHelper = new TKafkaInputHelper(tKafkaInputUtil);

    tKafkaInputHelper.generateKafkaProperties(cid);
    tKafkaInputHelper.generateKafkaTopics(cid);

    boolean useHierarchical =
        "true".equals(ElementParameterParser.getValue(node, "__USE_HIERARCHICAL__"));

    if (useHierarchical) {
      String schemaFileName = ElementParameterParser.getValue(node, "__SCHEMA_FILENAME__");

      stringBuffer.append(TEXT_25);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_26);
      stringBuffer.append(schemaFileName);
      stringBuffer.append(TEXT_27);
      stringBuffer.append(TEXT_28);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_29);
      stringBuffer.append(cid);
      stringBuffer.append(TEXT_30);
    }

    stringBuffer.append(TEXT_31);
    stringBuffer.append(tKafkaInputUtil.getOutgoingConnection().getName());
    stringBuffer.append(TEXT_32);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_33);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_34);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_35);
    stringBuffer.append(cid);
    stringBuffer.append(TEXT_36);
    stringBuffer.append(TEXT_37);
    return stringBuffer.toString();
  }