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

View File

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

View File

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

View File

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