// Path: mesos-rxjava-util/src/main/java/com/mesosphere/mesos/rx/java/util/MessageCodec.java
// public interface MessageCodec<T> {
// 
//     /**
//      * Serialize the given {@code message} into an array of bytes.
//      *
//      * @param message the message to serialize
//      * @return the serialized message
//      */
//     @NotNull
//     byte[] encode(@NotNull final T message);
// 
//     /**
//      * Deserialize the given byte array into a message.
//      *
//      * @param bytes the bytes to deserialize
//      * @return the deserialized message
//      * @throws RuntimeException If an error occurs when decoding {@code bytes}. If a checked exception is possible
//      *                          it should be wrapped in a RuntimeException.
//      */
//     @NotNull
//     T decode(@NotNull final byte[] bytes);
// 
//     /**
//      * Deserialize the given byte array into a message.
//      *
//      * @param in The {@link InputStream} to deserialize the message from
//      * @return the deserialized message
//      * @throws RuntimeException If an error occurs when decoding {@code bytes}. If a checked exception is possible
//      *                          it should be wrapped in a RuntimeException.
//      */
//     @NotNull
//     T decode(@NotNull final InputStream in);
// 
//     /**
//      * Returns the <a target="_blank" href="https://en.wikipedia.org/wiki/Media_type">IANA media type</a> of the serialized message
//      * format handled by this object.
//      * <p>
//      * The value returned by this method will be used in the {@code Content-Type} and {@code Accept} headers for
//      * messages sent to and received from Mesos, respectively.
//      *
//      * @return the media type identifier
//      */
//     @NotNull
//     String mediaType();
// 
//     /**
//      * Renders the given {@code message} to informative, human-readable text.
//      * <p>
//      * The intent of this method is to allow messages to be easily read in program logs and while debugging.
//      *
//      * @param message the message to render
//      * @return the rendered message
//      */
//     @NotNull
//     String show(@NotNull final T message);
// 
// }


import com.mesosphere.mesos.rx.java.util.MessageCodec;
import org.apache.mesos.v1.scheduler.Protos;
/*
 *    Copyright (C) 2016 Mesosphere, 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 com.mesosphere.mesos.rx.java.protobuf;


/**
 * A pair of {@link MessageCodec}s for {@link org.apache.mesos.v1.scheduler.Protos.Call} and
 * {@link org.apache.mesos.v1.scheduler.Protos.Event}
 */
public final class ProtobufMessageCodecs {

    private ProtobufMessageCodecs() {}

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.scheduler.Protos.Call Call}. */
    public static final MessageCodec<Protos.Call> SCHEDULER_CALL = new ProtoCodec<>(
        Protos.Call::parseFrom, Protos.Call::parseFrom
    );

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.scheduler.Protos.Event Event}. */
    public static final MessageCodec<Protos.Event> SCHEDULER_EVENT = new ProtoCodec<>(
        Protos.Event::parseFrom, Protos.Event::parseFrom
    );

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.executor.Protos.Call Call}. */
// Path: mesos-rxjava-util/src/main/java/com/mesosphere/mesos/rx/java/util/MessageCodec.java
// public interface MessageCodec<T> {
// 
//     /**
//      * Serialize the given {@code message} into an array of bytes.
//      *
//      * @param message the message to serialize
//      * @return the serialized message
//      */
//     @NotNull
//     byte[] encode(@NotNull final T message);
// 
//     /**
//      * Deserialize the given byte array into a message.
//      *
//      * @param bytes the bytes to deserialize
//      * @return the deserialized message
//      * @throws RuntimeException If an error occurs when decoding {@code bytes}. If a checked exception is possible
//      *                          it should be wrapped in a RuntimeException.
//      */
//     @NotNull
//     T decode(@NotNull final byte[] bytes);
// 
//     /**
//      * Deserialize the given byte array into a message.
//      *
//      * @param in The {@link InputStream} to deserialize the message from
//      * @return the deserialized message
//      * @throws RuntimeException If an error occurs when decoding {@code bytes}. If a checked exception is possible
//      *                          it should be wrapped in a RuntimeException.
//      */
//     @NotNull
//     T decode(@NotNull final InputStream in);
// 
//     /**
//      * Returns the <a target="_blank" href="https://en.wikipedia.org/wiki/Media_type">IANA media type</a> of the serialized message
//      * format handled by this object.
//      * <p>
//      * The value returned by this method will be used in the {@code Content-Type} and {@code Accept} headers for
//      * messages sent to and received from Mesos, respectively.
//      *
//      * @return the media type identifier
//      */
//     @NotNull
//     String mediaType();
// 
//     /**
//      * Renders the given {@code message} to informative, human-readable text.
//      * <p>
//      * The intent of this method is to allow messages to be easily read in program logs and while debugging.
//      *
//      * @param message the message to render
//      * @return the rendered message
//      */
//     @NotNull
//     String show(@NotNull final T message);
// 
// }


// Path: mesos-rxjava-protobuf-client/src/main/java/com/mesosphere/mesos/rx/java/protobuf/ProtobufMessageCodecs.java
import com.mesosphere.mesos.rx.java.util.MessageCodec;
import org.apache.mesos.v1.scheduler.Protos;

/*
 *    Copyright (C) 2016 Mesosphere, 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 com.mesosphere.mesos.rx.java.protobuf;


/**
 * A pair of {@link MessageCodec}s for {@link org.apache.mesos.v1.scheduler.Protos.Call} and
 * {@link org.apache.mesos.v1.scheduler.Protos.Event}
 */
public final class ProtobufMessageCodecs {

    private ProtobufMessageCodecs() {}

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.scheduler.Protos.Call Call}. */
    public static final MessageCodec<Protos.Call> SCHEDULER_CALL = new ProtoCodec<>(
        Protos.Call::parseFrom, Protos.Call::parseFrom
    );

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.scheduler.Protos.Event Event}. */
    public static final MessageCodec<Protos.Event> SCHEDULER_EVENT = new ProtoCodec<>(
        Protos.Event::parseFrom, Protos.Event::parseFrom
    );

    /** A {@link MessageCodec} for {@link org.apache.mesos.v1.executor.Protos.Call Call}. */
    public static final MessageCodec<org.apache.mesos.v1.executor.Protos.Call> EXECUTOR_CALL = new ProtoCodec<>(