@Test public void testBasicExcludeFilter() { DescribeSObjectResult dsrIn = new DescribeSObjectResult(); dsrIn.setName("Object_Name_In__c"); DescribeSObjectResult dsrOut = new DescribeSObjectResult(); dsrOut.setName("Object_Name_Out__c"); List<DescribeSObjectResult> dsrs = new ObjectNameFilter(false, "Object_Name_Out__c").filter(Lists.newArrayList(dsrIn, dsrOut)); assertNotNull(dsrs, "An object name filter of a non-null value should be non-null"); assertEquals(dsrs.size(), 1, "Unexpected number of DescribeSObjectResults after object name filter"); assertEquals(dsrs.get(0).getName(), "Object_Name_In__c", "Unexpected DescribeSObjectResult after object name filter"); }
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; }
ObjectNameFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; } }
ObjectNameFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; } ObjectNameFilter(boolean include, Set<String> objectNames);  ObjectNameFilter(boolean include, String... objectNames); }
ObjectNameFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; } ObjectNameFilter(boolean include, Set<String> objectNames);  ObjectNameFilter(boolean include, String... objectNames); @Override List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs); Set<String> getObjectNames(); boolean isInclude(); }
ObjectNameFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { List<DescribeSObjectResult> filteredResult = new ArrayList<DescribeSObjectResult>(); for (DescribeSObjectResult dsr : dsrs) { if (include == objectNames.contains(dsr.getName())) { filteredResult.add(dsr); } } return filteredResult; } ObjectNameFilter(boolean include, Set<String> objectNames);  ObjectNameFilter(boolean include, String... objectNames); @Override List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs); Set<String> getObjectNames(); boolean isInclude();  }