List of usage examples for com.google.common.collect Sets newEnumSet
public static <E extends Enum<E>> EnumSet<E> newEnumSet(Iterable<E> iterable, Class<E> elementType)
From source file:io.crate.operation.projectors.GroupingProjector.java
@Override public Set<Requirement> requirements() { if (requirements == null) { requirements = Sets.newEnumSet(downstream.requirements(), Requirement.class); requirements.remove(Requirement.REPEAT); }/*from www . ja va2 s . co m*/ return requirements; }
From source file:org.gbif.api.model.checklistbank.NameUsage.java
public void setIssues(Set<NameUsageIssue> issues) { Preconditions.checkNotNull(issues, "Issues cannot be null"); this.issues = Sets.newEnumSet(issues, NameUsageIssue.class); }
From source file:org.gbif.api.model.occurrence.Occurrence.java
public void setIssues(Set<OccurrenceIssue> issues) { Preconditions.checkNotNull("Issues cannot be null", issues); this.issues = Sets.newEnumSet(issues, OccurrenceIssue.class); }
From source file:org.auraframework.test.util.WebDriverTestCase.java
/** * Find all the browsers the current test case should be executed in. Test cases can be annotated with multiple * target browsers. If the testcase does not have an annotation, the class level annotation is used. * //from ww w . j a v a2 s. com * @return * @throws NoSuchMethodException */ public Set<BrowserType> getTargetBrowsers() { TargetBrowsers targetBrowsers = null; try { Method method = getClass().getMethod(getName()); targetBrowsers = method.getAnnotation(TargetBrowsers.class); if (targetBrowsers == null) { // Inherit defaults from the test class targetBrowsers = getClass().getAnnotation(TargetBrowsers.class); } } catch (NoSuchMethodException e) { // Do nothing } if (targetBrowsers == null) { // If no target browsers are specified, default to ALL return EnumSet.allOf(BrowserType.class); } return Sets.newEnumSet(Arrays.asList(targetBrowsers.value()), BrowserType.class); }
From source file:org.auraframework.test.util.WebDriverTestCase.java
/** * Browser types to be excluded for this testcase or test class. * /*from w w w . j a v a 2 s . co m*/ * @return * @throws NoSuchMethodException */ public Set<BrowserType> getExcludedBrowsers() { ExcludeBrowsers excludeBrowsers = null; try { Method method = getClass().getMethod(getName()); excludeBrowsers = method.getAnnotation(ExcludeBrowsers.class); if (excludeBrowsers == null) { // Inherit defaults from the test class excludeBrowsers = getClass().getAnnotation(ExcludeBrowsers.class); } } catch (NoSuchMethodException e) { // Do nothing } if (excludeBrowsers == null) { return EnumSet.noneOf(BrowserType.class); } return Sets.newEnumSet(Arrays.asList(excludeBrowsers.value()), BrowserType.class); }
From source file:com.android.tools.idea.res.ResourceHelper.java
/** * Returns the list of all resource names that can be used as a value for one of the {@link ResourceType} in completionTypes, * optionally sorting/not sorting the results. */// w w w. j a v a2s .c om @NotNull public static List<String> getCompletionFromTypes(@NotNull AndroidFacet facet, @NotNull EnumSet<ResourceType> completionTypes, boolean sort) { EnumSet<ResourceType> types = Sets.newEnumSet(completionTypes, ResourceType.class); // Use drawables for mipmaps if (types.contains(ResourceType.MIPMAP)) { types.add(ResourceType.DRAWABLE); } else if (types.contains(ResourceType.DRAWABLE)) { types.add(ResourceType.MIPMAP); } boolean completionTypesContainsColor = types.contains(ResourceType.COLOR); if (types.contains(ResourceType.DRAWABLE)) { // The Drawable type accepts colors as value but not color state lists. types.add(ResourceType.COLOR); } AppResourceRepository repository = AppResourceRepository.getAppResources(facet, true); ResourceVisibilityLookup lookup = repository.getResourceVisibility(facet); AndroidPlatform androidPlatform = AndroidPlatform.getInstance(facet.getModule()); FrameworkResources frameworkResources = null; if (androidPlatform != null) { AndroidTargetData targetData = androidPlatform.getSdkData().getTargetData(androidPlatform.getTarget()); try { frameworkResources = targetData.getFrameworkResources(true); } catch (IOException ignore) { } } List<String> resources = Lists.newArrayListWithCapacity(500); for (ResourceType type : types) { // If type == ResourceType.COLOR, we want to include file resources (i.e. color state lists) only in the case where // color was present in completionTypes, and not if we added it because of the presence of ResourceType.DRAWABLES. // For any other ResourceType, we always include file resources. boolean includeFileResources = (type != ResourceType.COLOR) || completionTypesContainsColor; if (frameworkResources != null) { addFrameworkItems(resources, type, includeFileResources, frameworkResources); } addProjectItems(resources, type, includeFileResources, repository, lookup); } if (sort) { Collections.sort(resources, ResourceHelper::compareResourceReferences); } return resources; }