Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2015 Square, 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.squareup.wire.schema;
import com.squareup.wire.FieldEncoding;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.jvm.JvmClassMappingKt;
/**
* Creates type adapters to read and write protocol buffer data from a schema model. This doesn't
* require an intermediate code gen step.
*/
final class SchemaProtoAdapterFactory {
final Schema schema;
final boolean includeUnknown;
final Map> adapterMap = new LinkedHashMap<>();
SchemaProtoAdapterFactory(Schema schema, boolean includeUnknown) {
this.schema = schema;
this.includeUnknown = includeUnknown;
adapterMap.put(ProtoType.BOOL, ProtoAdapter.BOOL);
adapterMap.put(ProtoType.BYTES, ProtoAdapter.BYTES);
adapterMap.put(ProtoType.DOUBLE, ProtoAdapter.DOUBLE);
adapterMap.put(ProtoType.FLOAT, ProtoAdapter.FLOAT);
adapterMap.put(ProtoType.FIXED32, ProtoAdapter.FIXED32);
adapterMap.put(ProtoType.FIXED64, ProtoAdapter.FIXED64);
adapterMap.put(ProtoType.INT32, ProtoAdapter.INT32);
adapterMap.put(ProtoType.INT64, ProtoAdapter.INT64);
adapterMap.put(ProtoType.SFIXED32, ProtoAdapter.SFIXED32);
adapterMap.put(ProtoType.SFIXED64, ProtoAdapter.SFIXED64);
adapterMap.put(ProtoType.SINT32, ProtoAdapter.SINT32);
adapterMap.put(ProtoType.SINT64, ProtoAdapter.SINT64);
adapterMap.put(ProtoType.STRING, ProtoAdapter.STRING);
adapterMap.put(ProtoType.UINT32, ProtoAdapter.UINT32);
adapterMap.put(ProtoType.UINT64, ProtoAdapter.UINT64);
}
public ProtoAdapter