Skip to content

Instantly share code, notes, and snippets.

View thomasfenaroli-wf's full-sized avatar

thomasfenaroli-wf

View GitHub Profile
@Override
public Unit process() {
Set<Method> annotatedMethods = reflections.getMethodsAnnotatedWith(annotationClass);
Set<Field> annotatedFields = reflections.getFieldsAnnotatedWith(annotationClass);
List<DataSet> dataSets = Sets.union(annotatedFields, annotatedMethods).stream()
.map(this::buildDataSet)
.sorted(Comparator.comparing(DataSet::getStaleAt))
.toList();
Multimap<Author, StaleDatasetRow> authorToStaleDatasetRows = ArrayListMultimap.create();
public class WReflectionsModule extends AbstractModule {
@Override
public void configure() {
bind(Reflections.class).toProvider(WReflectionsProvider.class).in(ImmutableSingleton.class);
}
public static class WReflectionsProvider implements Provider<Reflections> {
private static final Log LOG = getLog(WReflectionsProvider.class);
@Component(
crons = {
@Cronjob(
query = AlertOnStaleOrExpiredDatasets.class,
conditions = IsLeaderQueryPredicate.class,
triggers = "0 0 9 * * ?")
},
modules = WReflectionsModule.class,
queries = AlertOnStaleOrExpiredDatasets.class
)
public class IraContributionLimitCalculator {
@ValidUntil(
author = "TRADING_PRODUCTS_TEAM",
staleAt = "2025-12-01",
expiredAt = "2026-01-01",
message = "Add IRA contribution limit for 2026"
)
private static final RangeMap<Year, Money> yearToIraContributionLimit = ImmutableRangeMap.<Year, Money>builder()
.put(atMost(year(2021)), money(6000))
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ValidUntil {
String staleAt() default "";
String expiredAt() default "";
String author();