List of usage examples for java.util EnumSet noneOf
public static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType)
From source file:netbeanstypescript.TSNameKindModifiers.java
TSNameKindModifiers(JSONObject obj) { name = (String) obj.get("name"); // See ScriptElementKind in services/services.ts switch ((String) obj.get("kind")) { case "keyword": kind = ElementKind.KEYWORD; break;//from w ww . ja va2 s . com case "script": kind = ElementKind.FILE; break; case "module": kind = ElementKind.MODULE; break; case "class": kind = ElementKind.CLASS; break; case "interface": case "type": kind = ElementKind.INTERFACE; icon = interfaceIcon; break; case "enum": kind = ElementKind.CLASS; icon = enumIcon; break; case "var": kind = ElementKind.VARIABLE; break; case "local var": kind = ElementKind.VARIABLE; break; case "function": kind = ElementKind.METHOD; break; case "local function": kind = ElementKind.METHOD; break; case "method": kind = ElementKind.METHOD; break; case "getter": kind = ElementKind.FIELD; break; case "setter": kind = ElementKind.FIELD; break; case "property": kind = ElementKind.FIELD; break; case "constructor": kind = ElementKind.CONSTRUCTOR; break; case "call": break; case "index": break; case "construct": break; case "parameter": kind = ElementKind.PARAMETER; break; case "type parameter": break; case "primitive type": break; case "label": break; case "alias": break; case "const": kind = ElementKind.CONSTANT; break; case "let": kind = ElementKind.VARIABLE; break; case "directory": kind = ElementKind.PACKAGE; icon = folderIcon; break; case "external module name": kind = ElementKind.MODULE; break; default: TSService.log.log(Level.WARNING, "Unknown symbol kind [{0}]", obj.get("kind")); } // See ScriptElementKindModifier in services/services.ts String kindModifiers = (String) obj.get("kindModifiers"); if (kindModifiers != null && !kindModifiers.isEmpty()) { modifiers = EnumSet.noneOf(Modifier.class); for (String modifier : kindModifiers.split(",")) { switch (modifier) { case "public": modifiers.add(Modifier.PUBLIC); break; case "private": modifiers.add(Modifier.PRIVATE); break; case "protected": modifiers.add(Modifier.PROTECTED); break; case "export": break; case "declare": break; case "static": modifiers.add(Modifier.STATIC); break; case "abstract": modifiers.add(Modifier.ABSTRACT); break; case "deprecated": modifiers.add(Modifier.DEPRECATED); break; default: TSService.log.log(Level.WARNING, "Unknown modifier [{0}]", modifier); } } } }
From source file:ru.savvy.jpafilterbuilder.FieldFilterHelper.java
private void initIfEmpty(String fieldName) { if (!fields.containsKey(fieldName)) { fields.put(fieldName, new FieldFilterMutable(fieldName, null, EnumSet.noneOf(Option.class))); }/* ww w.jav a2 s .c o m*/ }
From source file:net.xy.jcms.controller.configurations.parser.UsecaseDBConnector.java
/** * parses an comma and newline separated list of Controllers in the form of: * java.lang.XController,Params,ControllerConfig,ContentRepository * // w ww . j av a 2 s . c o m * @param res * @return * @throws ClassNotFoundException */ private static Controller[] parseControllers(final String res, final ClassLoader loader) throws ClassNotFoundException { final List<Controller> ctrls = new ArrayList<Controller>(); final String[] lines = res.split("\n"); for (final String line : lines) { final String[] parsLine = line.split(","); final EnumSet<ConfigurationType> omConfigs = EnumSet.noneOf(ConfigurationType.class); String ctrlClassName = null; for (int i = 0; i < parsLine.length; i++) { if (i == 0) { ctrlClassName = parsLine[i]; } else { omConfigs.add(ConfigurationType.valueOf(parsLine[i])); } } ctrls.add(new Controller(ControllerPool.get(ctrlClassName, loader), omConfigs)); } return ctrls.toArray(new Controller[ctrls.size()]); }
From source file:org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetApplicationsRequestPBImpl.java
private void initApplicationStates() { if (this.applicationStates != null) { return;//from ww w.ja v a2 s .co m } GetApplicationsRequestProtoOrBuilder p = viaProto ? proto : builder; List<YarnApplicationStateProto> appStatesList = p.getApplicationStatesList(); this.applicationStates = EnumSet.noneOf(YarnApplicationState.class); for (YarnApplicationStateProto c : appStatesList) { this.applicationStates.add(ProtoUtils.convertFromProtoFormat(c)); } }
From source file:org.apache.hadoop.mapred.ResourceMgrDelegate.java
public JobStatus[] getAllJobs() throws IOException, InterruptedException { try {//from w ww .j a v a 2 s. c o m Set<String> appTypes = new HashSet<String>(1); appTypes.add(MRJobConfig.MR_APPLICATION_TYPE); EnumSet<YarnApplicationState> appStates = EnumSet.noneOf(YarnApplicationState.class); return TypeConverter.fromYarnApps(client.getApplications(appTypes, appStates), this.conf); } catch (YarnException e) { throw new IOException(e); } }
From source file:org.apache.hadoop.hdfs.security.token.block.TestBlockToken.java
@Test public void testWritable() throws Exception { TestWritable.testWritable(new BlockTokenIdentifier()); BlockTokenSecretManager sm = new BlockTokenSecretManager(true, blockKeyUpdateInterval, blockTokenLifetime); TestWritable/* www. j av a 2 s . c om*/ .testWritable(generateTokenId(sm, block1, EnumSet.allOf(BlockTokenSecretManager.AccessMode.class))); TestWritable .testWritable(generateTokenId(sm, block2, EnumSet.of(BlockTokenSecretManager.AccessMode.WRITE))); TestWritable.testWritable( generateTokenId(sm, block3, EnumSet.noneOf(BlockTokenSecretManager.AccessMode.class))); }
From source file:org.sigmah.server.auth.SigmahAuthDictionaryServlet.java
/** * Aggregates the list of profiles of a user. * * @param user/*from www . j a v a 2s .c om*/ * The user. * @param infos * The optional user info to fill. * @return The aggregated profile DTO. */ public static ProfileDTO aggregateProfiles(User user, UserInfoDTO infos, Injector injector) { // Profiles. if (infos != null) { infos.setProfiles(new ArrayList<ProfileDTO>()); } // The user may have several profiles which link it to its org unit. // This handler merges also all the profiles in one 'aggregated // profile'. final ProfileDTO aggretatedProfileDTO = new ProfileDTO(); aggretatedProfileDTO.setName("AGGREGATED_PROFILE"); aggretatedProfileDTO.setGlobalPermissions(EnumSet.noneOf(GlobalPermissionEnum.class)); aggretatedProfileDTO.setPrivacyGroups(new HashMap<PrivacyGroupDTO, PrivacyGroupPermissionEnum>()); if (user != null && user.getOrgUnitWithProfiles() != null && user.getOrgUnitWithProfiles().getProfiles() != null) { // For each profile. for (final Profile profile : user.getOrgUnitWithProfiles().getProfiles()) { // Creates the corresponding profile DTO. final ProfileDTO profileDTO = new ProfileDTO(); profileDTO.setName(profile.getName()); // Global permissions. profileDTO.setGlobalPermissions(EnumSet.noneOf(GlobalPermissionEnum.class)); if (profile.getGlobalPermissions() != null) { for (final GlobalPermission p : profile.getGlobalPermissions()) { profileDTO.getGlobalPermissions().add(p.getPermission()); // Aggregates global permissions among profiles. aggretatedProfileDTO.getGlobalPermissions().add(p.getPermission()); } } final Mapper mapper = injector.getInstance(Mapper.class); // Privacy groups. profileDTO.setPrivacyGroups(new HashMap<PrivacyGroupDTO, PrivacyGroupPermissionEnum>()); if (profile.getPrivacyGroupPermissions() != null) { for (final PrivacyGroupPermission p : profile.getPrivacyGroupPermissions()) { final PrivacyGroupDTO groupDTO = mapper.map(p.getPrivacyGroup(), PrivacyGroupDTO.class); profileDTO.getPrivacyGroups().put(groupDTO, p.getPermission()); // Aggregates privacy groups among profiles. if (aggretatedProfileDTO.getPrivacyGroups() .get(groupDTO) != PrivacyGroupPermissionEnum.WRITE) { aggretatedProfileDTO.getPrivacyGroups().put(groupDTO, p.getPermission()); } } } if (infos != null) { infos.getProfiles().add(profileDTO); } } } if (infos != null) { infos.setAggregatedProfile(aggretatedProfileDTO); } return aggretatedProfileDTO; }
From source file:com.alliander.osgp.domain.core.services.SecurityService.java
private List<DeviceFunction> getDeviceFunctionsForAuthorizations( final List<DeviceAuthorization> authorizations) { if (authorizations == null || authorizations.isEmpty()) { return Collections.emptyList(); }//from w w w . ja v a 2s. co m final Set<DeviceFunctionGroup> authorizedFunctionGroups = EnumSet.noneOf(DeviceFunctionGroup.class); for (final DeviceAuthorization authorization : authorizations) { if (authorization.getFunctionGroup() != null) { authorizedFunctionGroups.add(authorization.getFunctionGroup()); } } return this.deviceFunctionMappingRepository.findByDeviceFunctionGroups(authorizedFunctionGroups); }
From source file:org.squashtest.tm.service.internal.chart.ColumnPrototypeModification.java
@SuppressWarnings("unchecked") private Set<EntityType> findTypeToRemove(Entry<Long, List<CustomFieldBinding>> entry) { List<CustomFieldBinding> allBinding = cufBindingDao .findAllByCustomFieldIdOrderByPositionAsc(entry.getKey()); allBinding.removeAll(entry.getValue()); Set<EntityType> remainingType = CollectionUtils.isEmpty(allBinding) ? EnumSet.noneOf(EntityType.class) : EnumSet.copyOf(CollectionUtils.collect(allBinding, TYPE_COLLECTOR)); Set<EntityType> typeToRemove = EnumSet.copyOf(CollectionUtils.collect(entry.getValue(), TYPE_COLLECTOR)); typeToRemove.removeAll(remainingType); return typeToRemove; }
From source file:com.github.anba.es6draft.util.TestGlobals.java
@Override protected void before() throws Throwable { if (!Resources.isEnabled(configuration)) { // skip initialization if test suite not enabled return;/*ww w . j ava 2s . c o m*/ } scriptCache = new ScriptCache(); // read options ... EnumSet<CompatibilityOption> compatibilityOptions = EnumSet.noneOf(CompatibilityOption.class); optionsFromMode(compatibilityOptions, configuration.getString("mode", DEFAULT_MODE)); optionsFromVersion(compatibilityOptions, configuration.getString("version", DEFAULT_VERSION)); optionsFromStage(compatibilityOptions, configuration.getString("stage", DEFAULT_STAGE)); optionsFromFeatures(compatibilityOptions, configuration.getList("features", DEFAULT_FEATURES)); options = compatibilityOptions; // pre-compile initialization scripts and modules scripts = compileScripts(); modules = compileModules(); }