/** * Reads the class and field annotations to populate the meta-data. */ public FilterMetaData(Class<? extends Filter> type) { Preconditions.checkNotNull(type, "type argument"); FilterInfo info = type.getAnnotation(FilterInfo.class); Preconditions.checkState(info != null, "Filters must be annotated with FilterInfo."); canonicalName = type.getCanonicalName(); name = info.name(); description = info.description(); backend = info.backend(); parameters = Lists.newArrayList(); for(Field field : type.getDeclaredFields()) { FilterParam filterParam = field.getAnnotation(FilterParam.class); if (filterParam == null) { // Skip fields that are not annotated continue; } parameters.add(new FilterParamMetaData(field, filterParam)); } }
/** * Reads the class and field annotations to populate the meta-data. */ public FilterMetaData(Class<? extends Filter> type) { Preconditions.checkNotNull(type, "type argument"); FilterInfo info = type.getAnnotation(FilterInfo.class); Preconditions.checkState(info != null, "Filters must be annotated with FilterInfo."); canonicalName = type.getCanonicalName(); name = info.name(); description = info.description(); backend = info.backend(); parameters = Lists.newArrayList(); for(Field field : type.getDeclaredFields()) { FilterParam filterParam = field.getAnnotation(FilterParam.class); if (filterParam == null) { // Skip fields that are not annotated continue; } parameters.add(new FilterParamMetaData(field, filterParam)); } }