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

io.reactivex.netty.contexts.StringSerializer Maven / Gradle / Ivy

There is a newer version: 0.5.1
Show newest version
/*
 * Copyright 2014 Netflix, Inc.
 *
 * 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
 *
 *     http://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.reactivex.netty.contexts;

import com.netflix.server.context.ContextSerializationException;
import com.netflix.server.context.DirectionAwareContextSerializer;

/**
 * A dumb serializer that does nothing. Its existence is to follow the pattern that a context always has a serializer.
 *
 * @author Nitesh Kant ([email protected])
 */
class StringSerializer implements DirectionAwareContextSerializer {

    static final DirectionAwareContextSerializer INSTANCE = new StringSerializer();

    @Override
    public int getVersion() {
        return 1;
    }

    @Override
    public String serialize(String toSerialize) throws ContextSerializationException {
        return toSerialize;
    }

    @Override
    public String deserialize(String serialized, int version) throws ContextSerializationException {
        return serialized;
    }

    @Override
    public String serialize(String toSerialize, Direction direction)
            throws ContextSerializationException {
        return toSerialize;
    }

    @Override
    public String deserialize(String serialized, Direction direction, int version)
            throws ContextSerializationException {
        return serialized;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy