public String generate()

in hollow/src/main/java/com/netflix/hollow/api/codegen/perfapi/HollowPerformanceAPIClassGenerator.java [37:109]


    public String generate() {
        StringBuilder builder = new StringBuilder();

        builder.append("package " + packageName + ";\n\n");

        builder.append("import com.netflix.hollow.api.perfapi.HollowListTypePerfAPI;\n" +
                "import com.netflix.hollow.api.perfapi.HollowMapTypePerfAPI;\n" +
                "import com.netflix.hollow.api.perfapi.HollowPerformanceAPI;\n" +
                "import com.netflix.hollow.api.perfapi.HollowSetTypePerfAPI;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowDataAccess;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowListTypeDataAccess;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowMapTypeDataAccess;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowObjectTypeDataAccess;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowSetTypeDataAccess;\n" +
                "import com.netflix.hollow.core.read.dataaccess.HollowTypeDataAccess;\n" +
                "import java.util.Set;\n" +
                "\n");

        builder.append("\n@SuppressWarnings(\"all\")\n");
        builder.append("public class " + apiClassName + " extends HollowPerformanceAPI {\n\n");

        List<HollowSchema> schemas = new ArrayList<>(dataset.getSchemas());
        schemas.sort(Comparator.comparing(HollowSchema::getName));

        for(HollowSchema schema : schemas) {
            String schemaName = schema.getName();

            switch(schema.getSchemaType()) {
                case OBJECT:
                    builder.append("    public final " + schemaName + "PerfAPI " + schemaName + ";\n");
                    break;
                case LIST:
                    builder.append("    public final HollowListTypePerfAPI " + schemaName + ";\n");
                    break;
                case SET:
                    builder.append("    public final HollowSetTypePerfAPI " + schemaName + ";\n");
                    break;
                case MAP:
                    builder.append("    public final HollowMapTypePerfAPI " + schemaName + ";\n");
                    break;
            }
        }

        builder.append("\n");

        builder.append("    public " + apiClassName + "(HollowDataAccess dataAccess) {\n");
        builder.append("        super(dataAccess);\n\n");

        for(HollowSchema schema : schemas) {
            String schemaName = schema.getName();

            switch (schema.getSchemaType()) {
                case OBJECT:
                    builder.append("        this." + schemaName + " = new " + schemaName + "PerfAPI(dataAccess, \"" + schemaName + "\", this);\n");
                    break;
                case LIST:
                    builder.append("        this." + schemaName + " = new HollowListTypePerfAPI(dataAccess, \"" + schemaName + "\", this);\n");
                    break;
                case MAP:
                    builder.append("        this." + schemaName + " = new HollowMapTypePerfAPI(dataAccess, \"" + schemaName + "\",  this);\n");
                    break;
                case SET:
                    builder.append("        this." + schemaName + " = new HollowSetTypePerfAPI(dataAccess, \"" + schemaName + "\",  this);\n");
                    break;
            }
        }

        builder.append("    }\n");

        builder.append("}");

        return builder.toString();
    }