core: deprecate MethodDescriptor.create

Use MethodDescriptor.newBuilder instead
This commit is contained in:
Łukasz Strzałkowski 2017-06-09 13:53:39 -07:00 committed by Carl Mastrangelo
parent 8d304b6892
commit 17af756df4
4 changed files with 12 additions and 3 deletions

View File

@ -200,7 +200,9 @@ public final class MethodDescriptor<ReqT, RespT> {
* @param requestMarshaller the marshaller used to encode and decode requests
* @param responseMarshaller the marshaller used to encode and decode responses
* @since 1.0.0
* @deprecated use {@link #newBuilder()}.
*/
@Deprecated
public static <RequestT, ResponseT> MethodDescriptor<RequestT, ResponseT> create(
MethodType type, String fullMethodName,
Marshaller<RequestT> requestMarshaller,

View File

@ -32,6 +32,7 @@ import org.junit.runners.JUnit4;
public class MethodDescriptorTest {
@Test
public void createMethodDescriptor() {
@SuppressWarnings("deprecation") // MethodDescriptor.create
MethodDescriptor<String, String> descriptor = MethodDescriptor.<String, String>create(
MethodType.CLIENT_STREAMING, "/package.service/method", new StringMarshaller(),
new StringMarshaller());

View File

@ -63,6 +63,7 @@ public class ServiceDescriptorTest {
@Test
public void failsOnNonMatchingNames() {
@SuppressWarnings("deprecation") // MethodDescriptor.create
List<MethodDescriptor<?, ?>> descriptors = Collections.<MethodDescriptor<?, ?>>singletonList(
MethodDescriptor.create(
MethodType.UNARY,
@ -78,6 +79,7 @@ public class ServiceDescriptorTest {
@Test
public void failsOnNonDuplicateNames() {
@SuppressWarnings("deprecation") // MethodDescriptor.create
List<MethodDescriptor<?, ?>> descriptors = Arrays.<MethodDescriptor<?, ?>>asList(
MethodDescriptor.create(
MethodType.UNARY,

View File

@ -131,9 +131,13 @@ public class CensusModulesTest {
}
};
private final MethodDescriptor<String, String> method = MethodDescriptor.create(
MethodDescriptor.MethodType.UNKNOWN, "package1.service2/method3",
MARSHALLER, MARSHALLER);
private final MethodDescriptor<String, String> method =
MethodDescriptor.<String, String>newBuilder()
.setType(MethodDescriptor.MethodType.UNKNOWN)
.setRequestMarshaller(MARSHALLER)
.setResponseMarshaller(MARSHALLER)
.setFullMethodName("package1.service2/method3")
.build();
private final FakeClock fakeClock = new FakeClock();
private final FakeStatsContextFactory statsCtxFactory = new FakeStatsContextFactory();
private final Random random = new Random(0);