protected final void addMethods(Type type, boolean allowReaders, boolean allowWriters) { Class<?> clazz = TypeToken.of(type).getRawType(); for (Method fieldMethod : findAnnotatedMethods(clazz, ThriftField.class)) { addMethod(type, fieldMethod, allowReaders, allowWriters); } // find invalid methods not skipped by findAnnotatedMethods() for (Method method : getAllDeclaredMethods(clazz)) { if (method.isAnnotationPresent(ThriftField.class) || hasThriftFieldAnnotation(method)) { if (!Modifier.isPublic(method.getModifiers())) { metadataErrors.addError("@ThriftField method '%s' is not public", method.toGenericString()); } if (Modifier.isStatic(method.getModifiers())) { metadataErrors.addError("@ThriftField method '%s' is static", method.toGenericString()); } } } }
protected final void addMethods(Type type, boolean allowReaders, boolean allowWriters) { Class<?> clazz = TypeToken.of(type).getRawType(); for (Method fieldMethod : findAnnotatedMethods(clazz, ThriftField.class)) { addMethod(type, fieldMethod, allowReaders, allowWriters); } // find invalid methods not skipped by findAnnotatedMethods() for (Method method : getAllDeclaredMethods(clazz)) { if (method.isAnnotationPresent(ThriftField.class) || hasThriftFieldAnnotation(method)) { if (!Modifier.isPublic(method.getModifiers())) { metadataErrors.addError("@ThriftField method '%s' is not public", method.toGenericString()); } if (Modifier.isStatic(method.getModifiers())) { metadataErrors.addError("@ThriftField method '%s' is static", method.toGenericString()); } } } }
@DataProvider public Object[][] getTestCasesWithLegacyFieldIds() { List<Object[]> cases = new ArrayList<>(); for (Method m : ReflectionHelper.findAnnotatedMethods(DummyService.class, ThriftMethod.class)) { String name = m.getName(); if (name.startsWith("validNonLegacy")) { continue; } else if (name.startsWith("validLegacy")) { cases.add(new Object[] { new Method[] { m } }); } else if (name.startsWith("invalid")) { continue; } else { throw new AssertionError("Weird method " + m); } } return cases.toArray(new Object[][] {}); }
@DataProvider public Object[][] getTestCasesWithInvalids() { List<Object[]> cases = new ArrayList<>(); for (Method m : ReflectionHelper.findAnnotatedMethods(DummyService.class, ThriftMethod.class)) { String name = m.getName(); if (name.startsWith("validNonLegacy")) { continue; } else if (name.startsWith("validLegacy")) { continue; } else if (name.startsWith("invalid")) { cases.add(new Object[] { new Method[] { m } }); } else { throw new AssertionError("Weird method " + m); } } return cases.toArray(new Object[][] {}); }
@DataProvider public Object[][] getTestCasesWithNonLegacyFieldIds() { List<Object[]> cases = new ArrayList<>(); for (Method m : ReflectionHelper.findAnnotatedMethods(DummyService.class, ThriftMethod.class)) { String name = m.getName(); if (name.startsWith("validNonLegacy")) { cases.add(new Object[] { new Method[] { m } }); } else if (name.startsWith("validLegacy")) { continue; } else if (name.startsWith("invalid")) { continue; } else { throw new AssertionError("Weird method " + m); } } return cases.toArray(new Object[][] {}); }
private void extractThriftUnionId() Collection<Method> idMethods = findAnnotatedMethods(getStructClass(), ThriftUnionId.class);
private void extractThriftUnionId() Collection<Method> idMethods = findAnnotatedMethods(getStructClass(), ThriftUnionId.class);
protected final void addBuilderMethods() for (Method method : findAnnotatedMethods(getBuilderClass(), ThriftConstructor.class)) { List<ParameterInjection> parameters = getParameterInjections( builderType,
protected final void addBuilderMethods() for (Method method : findAnnotatedMethods(getBuilderClass(), ThriftConstructor.class)) { List<ParameterInjection> parameters = getParameterInjections( builderType,