Calls {@link #shouldCollect(Context, CoreConfiguration, ReportField, ReportBuilder)} for each ReportField
and then {@link #collect(ReportField, Context, CoreConfiguration, ReportBuilder, CrashReportData)} if it returned true
170499
@Override
    public final void collect(@NonNull Context context, @NonNull CoreConfiguration config, @NonNull ReportBuilder reportBuilder, @NonNull CrashReportData target) throws CollectorException {
        for (ReportField field : reportFields) {
            try {
                if (shouldCollect(context, config, field, reportBuilder)) {
                    collect(field, context, config, reportBuilder, target);
                }
            } catch (Exception t) {
                target.put(field, (String) null);
                throw new CollectorException("Error while retrieving " + field.name() + " data:" + t.getMessage(), t);
            }
        }
    }
635154
public PreExecutionInterceptorContext shouldNotCollectCallTree(String reason) {
		if (!mustCollectCallTree) {
			logger.debug("Should not collect call tree because {}", reason);
			collectCallTree = false;
		}
		return this;
	}
1040654
@Override
	public void collect(IT record) {
		try {
			this.numRecordsIn.inc();
			this.outputCollector.collect(this.mapper.map(record));
		} catch (Exception ex) {
			throw new ExceptionInChainedStubException(this.taskName, ex);
		}
	}
1196145
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            if ((collectionClass != null) && (mapClass != null)) {
                collectionFields = new HashMap<>();
                aliases = new HashMap<>();
                stack = new OpcodeStack();
                JavaClass cls = classContext.getJavaClass();
                className = cls.getClassName();
                super.visitClassContext(classContext);
                for (FieldInfo fi : collectionFields.values()) {
                    if (fi.isSynchronized()) {
                        bugReporter.reportBug(new BugInstance(this, BugType.NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION.name(), NORMAL_PRIORITY)
                                .addClass(this).addField(fi.getFieldAnnotation()));
                    }
                }
            }
        } finally {
            collectionFields = null;
            aliases = null;
            stack = null;
        }
    }
189121
private Set<String> collectFields(Class clazz, String fieldPrefix, Set<String> fields) {
        Map<String, Class> fieldsAndClasses = getFieldsAndClasses(clazz, fieldPrefix);

        for (Map.Entry<String, Class> entry : fieldsAndClasses.entrySet()) {
            String field = entry.getKey();
            Class fieldClass = entry.getValue();

            if (DIRECTLY_PROJECTED_TYPES.contains(fieldClass) || Collection.class.isAssignableFrom(fieldClass)) {
                fields.add(field);
            } else {
                collectFields(fieldClass, field + ".", fields);
            }
        }

        return fields;
    }
601897
@Override
    public void collect(FeatureCollector collector) {
        logBanner(featureSettings.getJiraBaseUrl());

        String proxyUrl = featureSettings.getJiraProxyUrl();
        String proxyPort = featureSettings.getJiraProxyPort();

        if (!StringUtils.isEmpty(proxyUrl) && !StringUtils.isEmpty(proxyPort)) {
            System.setProperty("http.proxyHost", proxyUrl);
            System.setProperty("https.proxyHost", proxyUrl);
            System.setProperty("http.proxyPort", proxyPort);
            System.setProperty("https.proxyPort", proxyPort);
        }

        try {
            long startTime = System.currentTimeMillis();
            long diff = TimeUnit.MILLISECONDS.toHours(startTime - collector.getLastRefreshTime());
            LOGGER.info("JIRA Collector is set to work in " + collector.getMode() + " mode");
            if (diff > featureSettings.getRefreshTeamAndProjectHours()) {
                LOGGER.info("Hours since last run = " + diff + ". Collector is about to refresh Team/Board information");
                List<Team> teams = updateTeamInformation(collector);
                Set<Scope> scopes = updateProjectInformation(collector);
                if (collector.getLastExecuted() > 0) {
                    if (featureSettings.isCollectorItemOnlyUpdate()) {
                        refreshValidIssues(collector, getBoardList(collector.getId()), getScopeList(collector.getId()));
                    } else {
                        refreshValidIssues(collector, teams, scopes);
                    }
                }

                collector.setLastRefreshTime(System.currentTimeMillis());
                featureCollectorRepository.save(collector);
                LOGGER.info("Collected " + teams.size() + " teams and " + scopes.size() + " projects");
            } else {
                LOGGER.info("Hours since last run = " + diff + ". Collector is only collecting updated/new issues.");
            }
            updateStoryInformation(collector);
            log("Finished", startTime);
        } catch (Exception e) {
            // catch exception here so we don't blow up the collector completely
            LOGGER.error("Failed to collect jira information", e);
        }
    }
1362616
private static void collectFields(Class<?> type, List<Field> fields) {
        final Field[] declaredFields = type.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            if (isPersistable(declaredField)) {
                fields.add(declaredField);
            }
        }
        if (type.getSuperclass() != null) {
            collectFields(type.getSuperclass(), fields);
        }
    }
231575
protected void checkCollectionType(Collection c) {
        if (type != null) {
            for (Iterator iter = c.iterator(); iter.hasNext(); ) {
                Object element = iter.next();
                checkType(element);
            }
        }
    }
1026880
function isCollection(obj) {
  if (isPattern(obj)) {
    return false;
  }
  return Object.keys(obj).some(childKey => isPattern(obj[childKey]));
}
1290068
protected function includeCollectors()
    {
        if ($this->collectorsIncluded) {
            return;
        }

        $this->collectorsIncluded = true;

        foreach ($this->app->getModules() as $module) {

            if (!$module->isEnabled() || $module->collector() === null) {
                continue;
            }

            $instance = $this->container->make($module->collector());

            $reflection = new ReflectionClass($instance);

            if (!$reflection->isSubclassOf(Collector::class)) {
                continue;
            }

            $this->doCollect($module, $instance, $reflection, false);
        }
    }
992173
protected final void addDataCollector(final Class collectorName) {
		if (!DataCollector.class.isAssignableFrom(collectorName)) {
			throw new RuntimeException("Class must be subclass of DataCollector!");
		}
		collectors.add(collectorName);
	}
384703
public static void collect() {
        AsyncTask.execute(new Runnable() {
            @Override
            public void run() {
                devicePropertiesCollector.collect();
                appStateCollector.collect();
            }
        });
    }
1132788
public static boolean isCollection(EntityDataModel entityDataModel, String typeName) {
        EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName);
        if (entitySet != null) {
            return true;
        }
        try {
            if (Collection.class.isAssignableFrom(Class.forName(typeName))
                    || COLLECTION_PATTERN.matcher(typeName).matches()) {
                return true;
            }
        } catch (ClassNotFoundException e) {
            LOG.debug("Not possible to find class for type name: {}", typeName);
        }

        return false;
    }
939982
@Nullable
    private JSONObject collectConfiguration(@NonNull Context context) {
        try {
            return configToJson(context.getResources().getConfiguration());
        } catch (RuntimeException e) {
            ACRA.log.w(LOG_TAG, "Couldn't retrieve CrashConfiguration for : " + context.getPackageName(), e);
            return null;
        }
    }
1314539
public MultipleResultCollectorContext<DPO> collect(ResultCollector<?, DPO> resultCollector) {
        if (resultCollector != null) {
            addedTriggers.add(resultCollector);
            addedDataProviders.add(resultCollector);
        }

        // Stay in the same context and re-use the same instance because no type has changed
        return this;
    }
443477
void collectStats(final StatsCollector collector) {
    collector.record("compaction.count", compaction_count);
    collector.record("compaction.duplicates", duplicates_same, "type=identical");
    collector.record("compaction.duplicates", duplicates_different, "type=variant");
    if (!tsdb.config.enable_compactions()) {
      return;
    }
    // The remaining stats only make sense with compactions enabled.
    collector.record("compaction.queue.size", size);
    collector.record("compaction.errors", handle_read_error.errors, "rpc=read");
    collector.record("compaction.errors", handle_write_error.errors, "rpc=put");
    collector.record("compaction.errors", handle_delete_error.errors,
                     "rpc=delete");
    collector.record("compaction.writes", written_cells);
    collector.record("compaction.deletes", deleted_cells);
  }
785515
@Override
  public void collect(SpanCollector collector) throws IOException {
    spans1.spans.collect(collector);
    spans2.spans.collect(collector);
  }