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

io.micronaut.serde.oracle.jdbc.json.OracleJdbcJsonBinaryObjectMapper Maven / Gradle / Ivy

Go to download

Enables serialization/deserialization in Micronaut applications using build time information

The newest version!
/*
 * Copyright 2017-2021 original authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.micronaut.serde.oracle.jdbc.json;

import io.micronaut.context.annotation.BootstrapContextCompatible;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.Order;
import io.micronaut.json.JsonMapper;
import io.micronaut.serde.SerdeRegistry;
import io.micronaut.serde.config.SerdeConfiguration;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import oracle.sql.json.OracleJsonGenerator;
import oracle.sql.json.OracleJsonParser;

import java.io.InputStream;
import java.io.OutputStream;

/**
 * Implementation of the {@link JsonMapper} interface for Oracle JDBC Binary JSON.
 *
 * @author Denis Stepanov
 * @since 1.2.0
 */
@Singleton
@BootstrapContextCompatible
@Order(200) // lower precedence than Jackson
public final class OracleJdbcJsonBinaryObjectMapper extends AbstractOracleJdbcJsonObjectMapper {

    @Deprecated
    public OracleJdbcJsonBinaryObjectMapper(SerdeRegistry registry) {
        this(registry, (SerdeConfiguration) null);
    }

    @Deprecated
    public OracleJdbcJsonBinaryObjectMapper(SerdeRegistry registry, Class view) {
        this(registry, null, view);
    }

    @Internal
    @Inject
    public OracleJdbcJsonBinaryObjectMapper(SerdeRegistry registry, SerdeConfiguration serdeConfiguration) {
        super(registry, serdeConfiguration);
    }

    private OracleJdbcJsonBinaryObjectMapper(SerdeRegistry registry, SerdeConfiguration serdeConfiguration, Class view) {
        super(registry, serdeConfiguration, view);
    }

    @Override
    public JsonMapper cloneWithViewClass(Class viewClass) {
        return new OracleJdbcJsonBinaryObjectMapper(registry, serdeConfiguration, viewClass);
    }

    @Override
    OracleJsonParser getJsonParser(InputStream inputStream) {
        return oracleJsonFactory.createJsonBinaryParser(inputStream);
    }

    @Override
    OracleJsonGenerator createJsonGenerator(OutputStream outputStream) {
        return oracleJsonFactory.createJsonBinaryGenerator(outputStream);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy