List of usage examples for com.google.common.collect Sets immutableEnumSet
@GwtCompatible(serializable = true) public static <E extends Enum<E>> ImmutableSet<E> immutableEnumSet(Iterable<E> elements)
From source file:net.navatwo.jfxproperties.PropertyInfoBase.java
PropertyInfoBase(TypeToken<?> base, String name, @Nullable Field field, @Nullable Invokable<Object, ? extends V> getterRef, @Nullable Invokable<Object, Void> setterRef, @Nullable Invokable<Object, ? extends ReadOnlyProperty<V>> accessorRef) { this.base = checkNotNull(base, "base == null"); this.fieldRef = field; this.getterRef = getterRef; this.setterRef = setterRef; this.accessorRef = accessorRef; this.name = checkNotNull(name, "name == null"); checkBase(field, getterRef, setterRef, accessorRef); this.annotations = Stream.of(field, getterRef, setterRef, accessorRef).filter(Objects::nonNull) .map(AnnotatedElement::getAnnotations).flatMap(Arrays::stream) .collect(Gullectors.toImmutableList()); this.annotationClasses = annotations.stream().map(Object::getClass) .map(c -> (Class<? extends Annotation>) c).collect(Gullectors.toImmutableSet()); EnumSet<Mutability> mutability = EnumSet.noneOf(Mutability.class); if (accessorRef != null) { // now we can check if it's read-write based on the type of the property TypeToken<?> rType = accessorRef.getReturnType(); mutability.add(Mutability.Read); if (isProperty(rType.getRawType())) { mutability.add(Mutability.Write); }//from w w w. j a v a 2s .c om } if (getterRef != null) { mutability.add(Mutability.Read); } if (setterRef != null) { mutability.add(Mutability.Write); } this.mutability = Sets.immutableEnumSet(mutability); }
From source file:org.marketcetera.photon.internal.marketdata.DataFlowManager.java
/** * Constructor.//from w w w . j a v a 2 s.co m * * @param moduleManager * the module manager * @param requiredCapabilities * the capabilities this manager requires, cannot be empty * @param marketDataExecutor * an executor for long running module operations that * <strong>must</strong> execute tasks sequentially * @param marketDataRequestSupport * supports generating market data requests * @throws IllegalArgumentException * if any parameter is null, or if requiredCapabilities is empty */ protected DataFlowManager(final ModuleManager moduleManager, final Set<Capability> requiredCapabilities, final Executor marketDataExecutor, IMarketDataRequestSupport marketDataRequestSupport) { Validate.noNullElements( new Object[] { moduleManager, requiredCapabilities, marketDataExecutor, marketDataRequestSupport }); mModuleManager = moduleManager; mRequiredCapabilities = Sets.immutableEnumSet(requiredCapabilities); mMarketDataExecutor = marketDataExecutor; mMarketDataRequestSupport = marketDataRequestSupport; }
From source file:com.google.devtools.kythe.doc.MarkedSourceRenderer.java
/** * Extract and render a the simple identifier from {@link signature}. * * @param makeLink if provided, this function will be used to generate link URIs from semantic * node tickets. It may return null if there is no available URI. * @param signature the {@link MarkedSource} to render from. * @return SafeHtml.EMPTY if there is no such identifier. *//*w w w. jav a 2 s . c om*/ public static SafeHtml renderSimpleIdentifier(Function<String, SafeUrl> makeLink, MarkedSource signature) { return new RenderSimpleIdentifierState(makeLink).render(signature, Sets.immutableEnumSet(MarkedSource.Kind.IDENTIFIER), 0); }
From source file:dagger.internal.codegen.ModuleKind.java
/** Returns the kinds of modules that a module of this kind is allowed to include. */ ImmutableSet<ModuleKind> legalIncludedModuleKinds() { switch (this) { case MODULE://www.j a v a2s .c o m return Sets.immutableEnumSet(MODULE); case PRODUCER_MODULE: return Sets.immutableEnumSet(MODULE, PRODUCER_MODULE); } throw new AssertionError(this); }
From source file:com.google.api.codegen.InterfaceConfig.java
private static ImmutableMap<String, ImmutableSet<Status.Code>> createRetryCodesDefinition( DiagCollector diagCollector, InterfaceConfigProto interfaceConfigProto) { ImmutableMap.Builder<String, ImmutableSet<Status.Code>> builder = ImmutableMap.<String, ImmutableSet<Status.Code>>builder(); for (RetryCodesDefinitionProto retryDef : interfaceConfigProto.getRetryCodesDefList()) { EnumSet<Status.Code> codes = EnumSet.noneOf(Status.Code.class); for (String codeText : retryDef.getRetryCodesList()) { try { codes.add(Status.Code.valueOf(codeText)); } catch (IllegalArgumentException e) { diagCollector.addDiag(//from ww w . j av a 2s .co m Diag.error(SimpleLocation.TOPLEVEL, "status code not found: '%s' (in interface %s)", codeText, interfaceConfigProto.getName())); } } builder.put(retryDef.getName(), Sets.immutableEnumSet(codes)); } if (diagCollector.getErrorCount() > 0) { return null; } return builder.build(); }
From source file:com.assylias.jbloomberg.SubscriptionBuilder.java
Set<RealtimeField> getFields() {
return Sets.immutableEnumSet(fields);
}
From source file:com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.java
public MergeJavaResourcesTransform(@NonNull PackagingOptions packagingOptions, @NonNull Set<Scope> mergeScopes, @NonNull ContentType mergedType, @NonNull String name) { this.packagingOptions = new ParsedPackagingOptions(packagingOptions); this.name = name; this.mergeScopes = Sets.immutableEnumSet(mergeScopes); this.mergedType = ImmutableSet.of(mergedType); if (mergedType == QualifiedContent.DefaultContentType.RESOURCES) { validator = new FileValidator() { @Override/*from w w w . j a v a 2 s . c o m*/ public boolean validateJarPath(@NonNull String path) { return !path.endsWith(SdkConstants.DOT_CLASS) && !path.endsWith(SdkConstants.DOT_NATIVE_LIBS); } @Override public boolean validateFolderPath(@NonNull String path) { return !path.endsWith(SdkConstants.DOT_CLASS) && !path.endsWith(SdkConstants.DOT_NATIVE_LIBS); } @NonNull @Override public String folderPathToKey(@NonNull String path) { return path; } @NonNull @Override public String keyToFolderPath(@NonNull String path) { return path; } }; } else if (mergedType == ExtendedContentType.NATIVE_LIBS) { validator = new NativeLibValidator(); } else { throw new UnsupportedOperationException("mergedType param must be RESOURCES or NATIVE_LIBS"); } }
From source file:edu.mit.streamjit.util.bytecode.Method.java
public Method(java.lang.reflect.Constructor<?> ctor, Klass parent) { super(parent.getParent().types().getMethodType(ctor), "<init>"); //parent is set by our parent adding us to its list prior to making it //unmodifiable. (We can't add ourselves and have the list wrapped //unmodifiable later because it's stored in a final field.) this.modifiers = Sets.immutableEnumSet(Modifier.fromMethodBits(Shorts.checkedCast(ctor.getModifiers()))); //We're unresolved, so we don't have arguments or basic blocks. this.localVariables = null; }
From source file:com.google.devtools.kythe.doc.MarkedSourceRenderer.java
/** * Extract and render a the simple identifier from {@link signature} as plaintext. * * @param signature the {@link MarkedSource} to render from. * @return "" if there is no such identifier. */// ww w . j a va2 s.co m public static String renderSimpleIdentifierText(MarkedSource signature) { return new RenderSimpleIdentifierState(null).renderText(signature, Sets.immutableEnumSet(MarkedSource.Kind.IDENTIFIER), 0); }
From source file:org.trustedanalytics.user.manageusers.CfUsersService.java
@Override public Optional<User> addSpaceUser(UserRequest userRequest, UUID spaceGuid, String currentUser) { UUID orgGuid = UUID.fromString(userRequest.getOrgGuid()); Optional<UserIdNamePair> idNamePair = uaaClient.findUserIdByName(userRequest.getUsername()); if (!idNamePair.isPresent()) { inviteUserToSpace(userRequest.getUsername(), currentUser, orgGuid, spaceGuid, Sets.immutableEnumSet(userRequest.getRoles())); }//from ww w .j a v a 2 s.c om return idNamePair.map(pair -> { UUID userGuid = pair.getGuid(); assignOrgRolesToUser(userGuid, orgGuid, Role.USERS); assignSpaceRolesToUser(userGuid, spaceGuid, userRequest.getRoles().stream().toArray(Role[]::new)); return new User(userRequest.getUsername(), userGuid, userRequest.getRoles(), orgGuid); }); }