public static JavaSettings getInstance()

in extension-base/src/main/java/com/azure/autorest/extension/base/plugin/JavaSettings.java [85:189]


    public static JavaSettings getInstance() {
        if (instance == null) {
            AutorestSettings autorestSettings = new AutorestSettings();
            loadStringSetting("title", autorestSettings::setTitle);
            loadStringOrArraySettingAsArray("security", autorestSettings::setSecurity);
            loadStringOrArraySettingAsArray("security-scopes", autorestSettings::setSecurityScopes);
            loadStringSetting("security-header-name", autorestSettings::setSecurityHeaderName);

            loadStringSetting("tag", autorestSettings::setTag);
            loadStringSetting("base-folder", autorestSettings::setBaseFolder);
            loadStringSetting("output-folder", autorestSettings::setOutputFolder);
            loadStringSetting("java-sdks-folder", autorestSettings::setJavaSdksFolder);
            // input-file
            List<String> inputFiles = host.getValueWithJsonReader("input-file",
                jsonReader -> jsonReader.readArray(JsonReader::getString));
            if (inputFiles != null) {
                autorestSettings.getInputFiles().addAll(inputFiles);
                logger.debug("List of input files : {}", autorestSettings.getInputFiles());
            }
            // require (readme.md etc.)
            List<String> require = host.getValueWithJsonReader("require",
                jsonReader -> jsonReader.readArray(JsonReader::getString));
            if (require != null) {
                autorestSettings.getRequire().addAll(require);
                logger.debug("List of require : {}", autorestSettings.getRequire());
            }

            String fluent = getStringValue(host, "fluent");

            setHeader(getStringValue(host, "license-header"));
            instance = new JavaSettings(
                autorestSettings,
                host.getValueWithJsonReader("modelerfour", jsonReader -> jsonReader.readMap(JsonReader::readUntyped)),
                getBooleanValue(host, "azure-arm", false),
                getBooleanValue(host, "sdk-integration", false),
                fluent,
                getBooleanValue(host, "regenerate-pom", false),
                header,
                getStringValue(host, "service-name"),
                getStringValue(host, "namespace", "com.mycompany.app").toLowerCase(),
                getBooleanValue(host, "client-side-validations", false),
                getStringValue(host, "client-type-prefix"),
                getBooleanValue(host, "generate-client-interfaces", false),
                getBooleanValue(host, "generate-client-as-impl", false),
                getStringValue(host, "implementation-subpackage", "implementation"),
                getStringValue(host, "models-subpackage", "models"),
                getStringValue(host, "custom-types", ""),
                getStringValue(host, "custom-types-subpackage", ""),
                getStringValue(host, "fluent-subpackage", "fluent"),
                getBooleanValue(host, "required-parameter-client-methods", false),
                getBooleanValue(host, "generate-sync-async-clients", false),
                getBooleanValue(host, "generate-builder-per-client", false),
                getStringValue(host, "sync-methods", "essential"),
                getBooleanValue(host, "client-logger", false),
                getBooleanValue(host, "required-fields-as-ctor-args", false),
                getBooleanValue(host, "service-interface-as-public", true),
                getStringValue(host, "artifact-id", ""),
                getStringValue(host, "credential-types", "none"),
                getStringValue(host, "credential-scopes"),
                getStringValue(host, "customization-jar-path"),
                getStringValue(host, "customization-class"),
                getBooleanValue(host, "optional-constant-as-enum", false),
                getBooleanValue(host, "data-plane", false),
                getBooleanValue(host, "use-iterable", false),
                host.getValueWithJsonReader("service-versions", jsonReader -> jsonReader.readArray(JsonReader::getString)),
                getStringValue(host, "client-flattened-annotation-target", ""),
                getStringValue(host, "key-credential-header-name", ""),
                getBooleanValue(host, "disable-client-builder", false),
                host.getValueWithJsonReader("polling", jsonReader -> jsonReader.readMap(PollingDetails::fromJson)),
                getBooleanValue(host, "generate-samples", false),
                getBooleanValue(host, "generate-tests", false),
                false, //getBooleanValue(host, "generate-send-request-method", false),
                getBooleanValue(host, "annotate-getters-and-setters-for-serialization", false),
                getStringValue(host, "default-http-exception-type"),
                getBooleanValue(host, "use-default-http-status-code-to-exception-type-mapping", false),
                host.getValueWithJsonReader("http-status-code-to-exception-type-mapping", JavaSettings::parseStatusCodeMapping),
                getBooleanValue(host, "partial-update", false),
                // If fluent default to false, this is because the automated test generation ends up with invalid code.
                // Once that is fixed, this can be switched over to true.
                getBooleanValue(host, "generic-response-type", fluent == null),
                getBooleanValue(host, "stream-style-serialization", true),
                getBooleanValue(host, "enable-sync-stack", false),
                getBooleanValue(host, "output-model-immutable", false),
                getBooleanValue(host, "use-input-stream-for-binary", false),
                getBooleanValue(host, "no-custom-headers", true),
                getBooleanValue(host, "include-read-only-in-constructor-args", false),
                // setting the default as true as the Java design guideline recommends using String for URLs.
                getBooleanValue(host, "url-as-string", true),
                getBooleanValue(host, "uuid-as-string", false),

                // setting this to false by default as a lot of existing libraries still use swagger and
                // were generated with required = true set in JsonProperty annotation
                getBooleanValue(host, "disable-required-property-annotation", false),
                getBooleanValue(host, "enable-page-size", false),
                getBooleanValue(host, "use-key-credential", false),
                getBooleanValue(host, "null-byte-array-maps-to-empty-array", false),
                getBooleanValue(host, "graal-vm-config", false),
                getStringValue(host, "flavor", "Azure"),
                getBooleanValue(host, "disable-typed-headers-methods", false),
                getBooleanValue(host, "share-jsonserializable-code", false),
                getBooleanValue(host, "android", false)
            );
        }
        return instance;
    }