我有三种方法。如何从依赖其他数据方法的数据获取数据?
第一种方法从列表(其包含数据对象特定于我们的我的应用程序),它然后调用第二方法,传递它已经获取作为参数的数据取数据。
第二种方法然后使用此信息作为参考,从另一个列表中获取特定信息,调用第三个方法并将该信息作为参数传递给它。
第三种方法与第二种方法相同,使用传入的数据作为参考来查找列表中的特定数据。
现在的问题是,我想用完全不同的方法使用这些信息。
我该如何去调用我的方法来获取数据?
private void getRecords() {
List<LabelSet> allSets = labelSetStructureService.getLabelSets();
for (LabelSet labelSet : allSets) {
List<LabelSet> groups = labelSetStructureService.getLabelGroupsForSet(labelSet.getId());
for (LabelGroup group : groups) {
getValuesForLabel(group.getCustomerMeasure(), labelSetStructureService.getLabelsForLabelGroup(group.getCustomer().getId(), group.getId()), labelSet);
}
}
}
private void getValuesForLabel(CustomerMeasure measure, List<Label> labels, LabelSet labelSet) {
for (Label label : labels) {
List<LabelSet> usageRecs = labelDataService.getLabelData(label, LabelSetStorage.DAY_BY_MONTH_STORAGE, new DateTime(), new DateTime().minusWeeks(1));
preProcessUsageRecs(usageRecs, labelSet);
}
}
private List<LabelUsage> preProcessUsageRecs(List<LabelUsage> usageRecs, LabelSet labelSet) {
//Format records, use list instead strings where possible
List<LabelSet> usageRecords = usageRecs; {
for(LabelUsage labelUsage : usageRecs)
usageRecords.addAll(usageRecs);
}
return usageRecords;
}
需要进一步解释 – rptmat57
如果没有太多的代码,那么很高兴看到 –
通过返回语句传回所有内容? – Max