All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.styra.opa.openapi.utils.LazySingletonValue Maven / Gradle / Ivy

The newest version!
/* 
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

package com.styra.opa.openapi.utils;

import com.fasterxml.jackson.core.type.TypeReference;

public final class LazySingletonValue {
    
    private static final Object NOT_SET = new Object();
    
    private final String name;
    private final String json;
    private final TypeReference typeReference;
    private Object value = NOT_SET;
    
    public LazySingletonValue(String name, String json, TypeReference typeReference) {
        this.name = name;
        this.json = json;
        this.typeReference = typeReference;
    }

    @SuppressWarnings("unchecked")
    public T value() {
        if (value == NOT_SET) {
            value = Utils.readDefaultOrConstValue(name, json, typeReference);
        }
        return (T) value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy