mirror of https://github.com/grpc/grpc-java.git
Remove InternalMetadataHelper. (#8209)
This class wasn't really necessary.
This commit is contained in:
parent
a589c2c68f
commit
1cd925c3dd
|
@ -19,7 +19,7 @@ package io.grpc.binder;
|
|||
import android.os.Parcelable;
|
||||
import io.grpc.ExperimentalApi;
|
||||
import io.grpc.Metadata;
|
||||
import io.grpc.binder.internal.InternalMetadataHelper;
|
||||
import io.grpc.binder.internal.MetadataHelper;
|
||||
|
||||
/**
|
||||
* Utility methods for using Android Parcelable objects with gRPC.
|
||||
|
@ -39,7 +39,8 @@ public final class ParcelableUtils {
|
|||
*/
|
||||
public static <P extends Parcelable> Metadata.Key<P> metadataKey(
|
||||
String name, Parcelable.Creator<P> creator) {
|
||||
return InternalMetadataHelper.createParcelableMetadataKey(name, creator, false);
|
||||
return Metadata.Key.of(
|
||||
name, new MetadataHelper.ParcelableMetadataMarshaller<P>(creator, false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,8 @@ public final class ParcelableUtils {
|
|||
*/
|
||||
public static <P extends Parcelable> Metadata.Key<P> metadataKeyForImmutableType(
|
||||
String name, Parcelable.Creator<P> creator) {
|
||||
return InternalMetadataHelper.createParcelableMetadataKey(name, creator, true);
|
||||
return Metadata.Key.of(
|
||||
name, new MetadataHelper.ParcelableMetadataMarshaller<P>(creator, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright 2020 The gRPC 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
|
||||
*
|
||||
* 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.grpc.binder.internal;
|
||||
|
||||
import android.os.Parcelable;
|
||||
import io.grpc.Metadata;
|
||||
|
||||
/**
|
||||
* Accessor class for using MetadataHelper outside this package.
|
||||
*/
|
||||
public final class InternalMetadataHelper {
|
||||
|
||||
private InternalMetadataHelper() {}
|
||||
|
||||
public static <P extends Parcelable> Metadata.Key<P> createParcelableMetadataKey(
|
||||
String name, Parcelable.Creator<P> creator, boolean immutableType) {
|
||||
return Metadata.Key.of(
|
||||
name, new MetadataHelper.ParcelableMetadataMarshaller<P>(creator, immutableType));
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ import javax.annotation.Nullable;
|
|||
* The sentinel int at the start of a value may indicate bad metadata. When this happens, no more
|
||||
* data follows the sentinel.
|
||||
*/
|
||||
final class MetadataHelper {
|
||||
public final class MetadataHelper {
|
||||
|
||||
/** The generic metadata marshaller we use for reading parcelables from the transport. */
|
||||
private static final Metadata.BinaryStreamMarshaller<Parcelable> TRANSPORT_INBOUND_MARSHALLER =
|
||||
|
@ -194,13 +194,13 @@ final class MetadataHelper {
|
|||
}
|
||||
|
||||
/** A marshaller for passing parcelables in gRPC {@link Metadata} */
|
||||
static final class ParcelableMetadataMarshaller<P extends Parcelable>
|
||||
public static final class ParcelableMetadataMarshaller<P extends Parcelable>
|
||||
implements Metadata.BinaryStreamMarshaller<P> {
|
||||
|
||||
@Nullable private final Parcelable.Creator<P> creator;
|
||||
private final boolean immutableType;
|
||||
|
||||
ParcelableMetadataMarshaller(@Nullable Parcelable.Creator<P> creator, boolean immutableType) {
|
||||
public ParcelableMetadataMarshaller(@Nullable Parcelable.Creator<P> creator, boolean immutableType) {
|
||||
this.creator = creator;
|
||||
this.immutableType = immutableType;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue