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

io.github.springwolf.asyncapi.v3.model.components.ComponentSchema Maven / Gradle / Ivy

There is a newer version: 1.9.0
Show newest version
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.asyncapi.v3.model.components;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.github.springwolf.asyncapi.v3.jackson.model.channel.message.ComponentSchemaSerializer;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.springwolf.asyncapi.v3.model.schema.MultiFormatSchema;
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject;
import lombok.Getter;

@Getter
@JsonSerialize(using = ComponentSchemaSerializer.class)
public class ComponentSchema {
    private MultiFormatSchema multiFormatSchema;
    private SchemaObject schema;
    private MessageReference reference;

    private ComponentSchema(MultiFormatSchema multiFormatSchema) {
        this.multiFormatSchema = multiFormatSchema;
    }

    private ComponentSchema(SchemaObject schema) {
        this.schema = schema;
    }

    private ComponentSchema(MessageReference reference) {
        this.reference = reference;
    }

    public static ComponentSchema of(MultiFormatSchema multiFormatSchema) {
        return new ComponentSchema(multiFormatSchema);
    }

    public static ComponentSchema of(SchemaObject schema) {
        return new ComponentSchema(schema);
    }

    public static ComponentSchema of(MessageReference reference) {
        return new ComponentSchema(reference);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy